Instead of manually replicating the text, I wrote the following short script that does that for you.
The colour code I used on the parameters:
- Green - parameter Help present
- Yellow - parameter Help copied
- Red - no parameter Help found
- # Scans all cmdlets and parameters in a Help file
- # Stores the parameter Help text, if it finds any
- # Fills in the Help text on parameters with the same name that have no Help text
- # Result is saved in HelpFile-new.xml
- $HelpFile = 'HelpFile.xml'
- [xml]$help = Get-Content -Path $HelpFile
- $parmTab = @{}
- # Requires 2 runs to be independent of the order in the XML file
- 1..2 | %{
- Write-Host -ForegroundColor Blue "`nRun $_`n"
- # For each cmdlet
- foreach($cmd in $help.helpItems.command){
- Write-Host "$($cmd.details.name)"
- # For each parameter
- foreach($parm in $cmd.parameters.parameter){
- # Do we have help for that parameter
- if($parm.description.para)
- {
- Write-Host -ForegroundColor Green -NoNewline "`t$($parm.name)"
- # Remember it
- if(!$parmTab.ContainsKey($parm.name))
- {
- $parmTab.Add($parm.name,$parm.description.para)
- }
- Write-Host -ForegroundColor Green "`t`t$($parm.description.para)"
- }
- else
- {
- # Did we already have a text for this parameter
- if($parmTab.ContainsKey($parm.name))
- {
- Write-Host -ForegroundColor Yellow -NoNewline "`t$($parm.name)`t`t$($parmTab.Item($parm.name))"
- # Enter the help text
- $parm.description.para = $parmTab.Item($parm.name)
- }
- else
- {
- Write-Host -ForegroundColor Red -NoNewline "`t$($parm.name)"
- }
- Write-Host ''
- }
- }
- }
- }
- $help.Save($HelpFile.Replace('.xml','-new.xml'))