Skip to content

Instantly share code, notes, and snippets.

@juneb
Created June 16, 2016 16:19
Show Gist options
  • Save juneb/abacd51682a84a4b44a06b67da4cabab to your computer and use it in GitHub Desktop.
Save juneb/abacd51682a84a4b44a06b67da4cabab to your computer and use it in GitHub Desktop.
Gets the descriptions of a parameter from different commands in one or more modules.
<#
.SYNOPSIS
Gets the descriptions of a parameter from different
cmdlets in one or more modules.
.DESCRIPTION
The Get-ParameterDescriptionfromXMLFile script returns the
description of a parameter from cmdlets in one/more modules.
If the cmdlet has the parameter, but the description is blank,
the script returns the blank description.
.PARAMETER ParameterName
Specifies the name of the parameter. The script returns the
descriptions of this parameter from the topics of cmdlets
that have the parameter. The blank descriptions indicate that
the cmdlet help topic has the parameter, but the description
is blank.
.PARAMETER ModuleName
Searches for the parameter only in the specified module. By
default, this script searches all modules in the session.
.EXAMPLE
.\Get-ParameterDescriptionfromXMLfile.ps1 -ParameterName Slot
Get-AzureDeployment Specifies the environment for the deployment. Choices are Staging or Production. If not specified...
Get-AzureRole Specifies the Azure deployment environment. Choices are "Production" or "Staging".
Get-AzureServiceADDomainExtension
Get-AzureServiceAntimalwareConfig
Get-AzureServiceDiagnosticsExtension Specifies the environment of the deployment to modify. Supported values are "Production" or "Stag...
Get-AzureServiceExtension
Get-AzureServiceRemoteDesktopExtension Specifies the environment of the deployment to get. Supported values are "Production" or "Staging".
...
.EXAMPLE
.\Get-ParameterDescriptionfromXMLfile.ps1 -ParameterName Slot -Module Azure
.NOTES
For help with this script, see JuneB, x65065
#>
Param
(
[parameter(Mandatory=$True)]
[String]
$ParameterName,
[parameter(Mandatory=$False)]
[String]
$ModuleName
)
if ($ModuleName) {$cmdlets = Get-Command -ParameterName $ParameterName -CommandType Cmdlet -Module $ModuleName}
else {$cmdlets = Get-Command -ParameterName $ParameterName -CommandType Cmdlet}
foreach ($cmdlet in $cmdlets)
{
$cmdletName = $cmdlet.Name
$parm = Get-Help $cmdletName -Parameter $ParameterName -ErrorAction SilentlyContinue
if ($ModuleName)
{
[PSCustomObject]@{"Cmdlet"=$cmdletName; "Description"=$parm.description.text}
}
else
{
[PSCustomObject]@{"Cmdlet"=$cmdletName; "Module"=$cmdlet.ModuleName; "Description"=$parm.description.text}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment