Home > Blockchain >  How to view categories in Powershell v5?
How to view categories in Powershell v5?

Time:10-06

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?

CodePudding user response:

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 ').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

CodePudding user response:

Using Windows Powershell 5.1. when I look at help Get-Help -full, I read the following:

Parameters

-Category <System.String[]>

Displays help only for items in the specified category and their aliases. Conceptual articles are in the HelpFile category.

   Required?                    false
   Position?                    named
   Default value                None
   Accept pipeline input?       False
   Accept wildcard characters?  false

If I do a Get-Help * | Group-Object Category | Select-Object Name, I only see the following categories:

  • Alias
  • Function
  • ExternalScript
  • Cmdlet
  • HelpFile

I get the same categories in PowerShell v7.2

  • Related