Skip to content

Instantly share code, notes, and snippets.

@clemmesserli
Created February 3, 2022 08:32
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 clemmesserli/5b83597d25ef0575c007a4241523aea8 to your computer and use it in GitHub Desktop.
Save clemmesserli/5b83597d25ef0575c007a4241523aea8 to your computer and use it in GitHub Desktop.
Updates PS Help Files and then searches for new params added in support of PS v6 or v7
$excludeFilter = @(
'Confirm'
'Debug'
'ErrorAction'
'ErrorVariable'
'InformationAction'
'InformationVariable'
'OutBuffer'
'OutVariable'
'PipelineVariable'
'Verbose'
'WarningAction'
'WarningVariable'
'WhatIf'
)
$results = New-Object 'System.Collections.Generic.List[PSObject]'
# Get a list of modules installed that support updatable help as these will be most likely to include update notes related to PWSH
$modules = Get-Module -ListAvailable | Where-Object -Property HelpInfoUri
# Pull down the latest available help files
Update-Help -UICulture en-US -Module $modules
# Now run a series of nested loops and build a Collection of HashTable entries based on matches found
foreach ($module in $modules) {
$cmdlets = Get-Command -Module $module.name | Where CommandType -eq 'Cmdlet' | Select -exp Name
foreach ($cmdlet in $cmdlets) {
$params = (GET-Command $cmdlet).parameters.values.Name | where { $_ -notin $excludeFilter }
foreach ($param in $params) {
$help = get-help $cmdlet -parameter $param -ErrorAction SilentlyContinue
if ($help.PSobject.Properties.name -match "description") {
$text = ($help | Select-Object -ExpandProperty description).Text | Where-Object {
$_ -match 'introduced in PowerShell 6.*' -or
$_ -match 'introduced in PowerShell 7.*' -or
$_ -match 'added in PowerShell 6.*' -or
$_ -match 'added in PowerShell 7.*'
}
Write-Host "Fetching help on $module : $cmdlet : $param" -ForegroundColor Green
if ($text) {
$results.Add([PSCustomObject]@{
'ModuleName' = $module.Name
'ModuleAuthor' = $module.Author
'ModuleVersion' = $module.Version
'Cmdlet' = $cmdlet
'ParameterName' = $param
'Description' = $help.description.text -join ""
'ProjectUri' = $module.ProjectUri
'RepositorySourceLocation' = $module.RepositorySourceLocation
})
}
}
}
}
}
$results | out-gridview -Title 'PowerShell Core - Notable Updates'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment