Created
August 2, 2013 13:13
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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