Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Get-CommandGridView is a PowerShell function for exploring modules and snapins. You can read more by searching for Get-CommandGridView at blog.powershell.no
#requires -version 3
Function Get-CommandGridView {
[cmdletbinding()]
Param([string]$Module,
[ValidateRange(1,20)]
[int]$MaxHelpWindowCount = 5
)
#get commands for the module or snapin
$commands = Get-Command -Module $module
#if module or snapin not found, Get-Command doesn't throw an exception
#so I'll simply test if $commands contains anything
if ($commands) {
#include the module name because $Name could contain a wildcard
$Commands = $Commands |
Select-Object -Property Name,Noun,Verb,CommandType,ModuleName |
Out-Gridview -Title "$($Module.ToUpper()) Commands" -PassThru
if ($Commands) {
$Commands | Get-Help -ShowWindow
}
}
else {
Write-Warning "Failed to find any commands for module or snapin $name"
}
} #close Get-CommandGridView
Set-Alias -Name gcgv -Value Get-CommandGridView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment