Skip to content

Instantly share code, notes, and snippets.

@janegilring
Created August 2, 2013 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janegilring/6139783 to your computer and use it in GitHub Desktop.
Save janegilring/6139783 to your computer and use it in GitHub Desktop.
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