When you first install a module, you usually run a command something like Get-Command -Module newModule
to see what commands are available, right?
Well, this function is what I have been running. It still gives you the list of commands from the module, but with the help synopsis next to each one so you can see a little more about what they do. Here are a couple of examples, to encourage you to try it out:
Get-ModuleHelp Microsoft.PowerShell.Archive
Name Synopsis
---- --------
Compress-Archive Creates an archive, or zipped file, from specified files and folders.
Expand-Archive Extracts files from a specified archive (zipped) file.
Get-ModuleHelp Configuration
Name Synopsis
---- --------
Get-ManifestValue Reads a specific value from a PowerShell metdata file (e.g. a module manifest)
Get-StoragePath Gets an storage path for configuration files and data
Update-Manifest Update a single value in a PowerShell metadata file
Add-MetadataConverter Add a converter functions for serialization and deserialization to metadata
ConvertFrom-Metadata Deserializes objects from PowerShell Data language (PSD1)
ConvertTo-Metadata Serializes objects to PowerShell Data language (PSD1)
Export-Configuration Exports a configuration object to a specified path.
Export-Metadata Creates a metadata file from a simple object
Get-ConfigurationPath Gets an storage path for configuration files and data
Get-Metadata Reads a specific value from a PowerShell metdata file (e.g. a module manifest)
Import-Configuration Import the full, layered configuration for the module.
Import-Metadata Creates a data object from the items in a Metadata file (e.g. a .psd1)
Test-PSVersion Test the PowerShell Version
Update-Metadata Update a single value in a PowerShell metadata file
Update-Object Recursively updates a hashtable or custom object with new values
My new method involves adding a couple of properties to the command info class in my profile:
Update-TypeData -TypeName System.Management.Automation.CommandInfo -MemberName Syntax -Value {
($this | Get-Command -Syntax | Out-String).Trim()
} -MemberType ScriptProperty
Update-TypeData -TypeName System.Management.Automation.CommandInfo -MemberName Synopsis -Value {
($this | Get-Help).Synopsis.Trim()
} -MemberType ScriptProperty
And now I can get the same help by just formatting:
Get-Command -Module Microsoft.PowerShell.Archive | Format-Table Name, Synopsis
But I can also choose to add more information and (for instance), build useful reference pages for your commands:
Get-Command -Module Microsoft.* | Sort ModuleName | Select ModuleName, Verb, Noun, Name, Synopsis |
ConvertTo-Html -PostContent '<script src="https://cdn.rawgit.com/stevesouders/5952488/raw/activetable.js"></script>' |
Set-Content MicrosoftCommands.html