Search code examples
powershellpowershell-3.0

How to view categories in Powershell v5?


im running powershell v5 on my machine and i can't seem to run the command

GET-HELP -Category Provider.

Is there an alternative to this command which can be used in v5 or is it a command that's available to v3 Powershell?


Solution

  • While Provider is a valid category for help topics, none of the topics that ship with PowerShell use category Provider (anymore), as of Windows PowerShell 5.1 / PowerShell (Core) 7.2.x

    The next best thing is to use a wildcard-based search, using the Get-Help's (positionally implied) -Name parameter:

    Get-Help *provider*
    

    This will list all topics with the word provider in the name, which comprises both cmdlets with the word in the name and conceptual help topics (topics whose name starts with about_).

    If you want to limit the output to matching conceptual help topics (as Get-Help -Category Provider may have done in Windows PowerShell versions prior to v5.1):

    Get-Help *provider* -Category HelpFile
    # Alternative:
    Get-Help about_*provider*
    

    [1] The valid categories are: Alias, All, Class, Cmdlet, Configuration, DefaultHelp, DscResource, ExternalScript, FAQ, Filter, Function, General, Glossary, HelpFile, Provider, ScriptCommand, which correspond to the values of a non-public enumeration type, System.Management.Automation.HelpCategory; you can obtain these values programmatically with
    (TabExpansion2 'Get-Help -Category ' -cursorColumn 19).CompletionMatches.CompletionText.
    The topics that ship with Windows PowerShell v5.1 / as of PowerShell (Core) 7.2.x span the following categories: Alias, Cmdlet, ExternalScript, Filter, Function, HelpFile, as obtained with
    (Get-Help *).Category | % ToString | Sort-Object -Unique