Both the GetCommand and GetHelp cmdlets let you search for command names that match a given pattern. However, when you don’t know exactly what portions of a command name you are looking for, you will more often have success searching through the help content for an answer. On Unix systems, this command is called Apropos. Similar functionality does not exist as part of the PowerShell’s help facilities, however.
That doesn’t need to stop us, though, as we can write the functionality ourselves.
To run this program, supply a search string to the SearchHelp script The script then displays the name and synopsis of all help topics that match. To see the help content for that topic, use the GetHelp cmdlet.
############################################################################## ## ## SearchHelp.ps1 ## ## Search the PowerShell help documentation for a given keyword or regular ## expression. ## ## Example: ## SearchHelp hashtable ## SearchHelp "(datetime|ticks)" ##############################################################################
param($pattern = $(throw "Please specify content to search for"))
$helpNames = $(GetHelp * | WhereObject { $_.Category ne "Alias" })
foreach($helpTopic in $helpNames)
{ $content = GetHelp Full $helpTopic.Name | OutString if($content match $pattern) {
$helpTopic | SelectObject Name,Synopsis } }