While working on a new article for REDMOND magazine about PowerShell 2.0, I wanted to get some cmdlet information. I wanted an easy way to see a list of cmdlets for a given verb or noun. Of course that is easily done with Get-Command. However this only gives my the definition.
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
After a little experimenting I found that I could get the help synopsis with the actual Get-Help cmdlet, not the Help function. So combining the two gives me the results I need.
PS C:\> gcm -noun job | select Name,@{Name="Synopsis";Expression={(get-help $_).synopsis}} | ft -auto -wrap
Name Synopsis
---- --------
Get-Job Gets Windows PowerShell background jobs that are running
in the current session.
Receive-Job Gets the results of the Windows PowerShell background jobs
in the current session.
Remove-Job Deletes a Windows PowerShell background job.
Start-Job Starts a Windows PowerShell background job.
Stop-Job Stops a Windows PowerShell background job.
Wait-Job Suppresses the command prompt until one or all of the
Windows PowerShell background jobs running in the
session are complete.
This should work for most Get-Command expressions. Although you may need to tweak a bit. Here’s my solution for discovering about aliases:
PS C:\> gcm -type alias | select Name,ResolvedCommandName,@{Name="Synopsis";Expression={(get-help $_).synopsis}} | ft -wrap -auto
Have fun.
Note: Works on V1 also.
Thanks for the confirmation. I assumed it would but I didn’t have a v1 instance handy to verify.
Hi Jeffery,
Nice stuff, I added a small menu to it, so now I just type the number of the command(s) returned and it gives me the examples..
function Global:myHelp([string] $Cmd=$(Throw “Please provide a part of the command you are looking for”))
{
$results=gcm -noun $cmd
$ColCmds=@()
$iCount=0
foreach ($result in $results)
{
$iCount++
$objCmd = New-Object system.object
$objcmd | Add-Member -type NoteProperty -name Count -value $iCount
$objcmd | Add-Member -type NoteProperty -name Name -value $result.Name
$objCmd | Add-Member -type NoteProperty -Name Synopsis -value (get-help $result).synopsis
$colCmds += $objcmd
}
$colcmds | ft -auto -wrap
Write-Host -fore yellow ” to quit”
write-host -nonewline “Show Info 0 – ${iCount} : “;
$choice=[console]::readline()
if ($choice -and ($choice -lt 0) -or ($choice -gt $icount))
{
Write-Warning “‘${choice}’ is out of range!”
continue;
}
if($choice)
{
Get-help $colcmds[$choice-1].name -examples
}
}
Thx!!