by wardo at 2013-02-16 08:31:01
In Powershell 3 64-bit shell in Windows 7, the returned help results usually are what I’m expecting hwever sometimes they are odd. I first noticed this when I was looking if there was a command to return who was an administrator on a system. I ranby DonJ at 2013-02-17 06:04:09
help administratorand I got a large return of results and none of the returned items had administrator in the name column. I did a
help helpto verify that -NAME was the first positional parameter and that the search I was doing should translate to help -Name administrator, I still tried running
help -Name administratorto verifiy that I got the same results and I did.
After adding a function to my profile that is named get-administrators I now only find this command when I do a search, so I assumend this was a generic response to a search that didn’t have results. But there are other help searches that don’t respond correctly
If I run this seach
help processesthe first result returned is named Get-PSSessionConfiguration with a catagory of cmdlet. Why? There are cmdlets that actually have the word process in them, and if I run a
help process -category cmdletthis cmdlet and many others no longer show up in the returned results. Instead of showing me over a page of cmdlets I now only get the correct 5 results returned.
I’m still able to get the help I need, but it bugs me that I don’t understand why I get the result that I do. Any explanation would be helpful
If the help system doesn’t find a match on a command or help file name, it’ll do a text search of the synopsis for all installed commands. That’s what administrator is doing. And there typically aren’t command names that match processes because its plural and commands should use singular nouns. You’re likely getting commands that have “processes” in their synopsis. That’s why process returns different results - you’re getting matches on command names then.