Powershell

What are Approved Verbs for PowerShell Commands?

The approved verbs in PowerShell make sure that the specific cmdlet or function is following a particular verb-noun name structure. Moreover, it also ensures clarity and consistency in the syntax of a specific cmdlet. For that corresponding task, the “Get-Verb” cmdlet is utilized, which gets or retrieves the approved set of PowerShell verbs to use for commands.

The following post will uncover the details related to the approved verbs for PowerShell commands.

What are Approved Verbs for PowerShell Commands?

The approved verbs in PowerShell specify that the stated cmdlet or function follows the verb-noun naming structure. Examples related to the stated cmdlet are below given.

Example 1: Get a List of All Verbs by Executing the “Get-Verb” Cmdlet

Execute the “Get-Verb” cmdlet to get the list of all the available verbs in PowerShell:

Get-Verb

 

Example 2: Use the “Get-Verb” Cmdlet to Retrieve the List of Approved Verbs that Starts with “Ex”

Get the approved list of verbs that start with the “EX” keyword. To do so, first, place the “Get-Verb” along with the keyword to find the verbs related to it by adding the wildcard “*” with it:

Get-Verb Ex*

 

Example 3: Retrieve Commands in a Module that Includes Verbs that are Unapproved

To retrieve the list of unapproved verbs, run the provided command:

Get-Command -Module Microsoft.PowerShell.Utility | Where-Object Verb -NotIn (Get-Verb).Verb

 
According to the above code:

    • First, provide the “Get-Command” cmdlet alongside the “-Module” parameter having the specified value assigned to it.
    • Next, place the “|” pipeline and the “Where-Object” cmdlet.
    • Then, specify the “Verb” cmdlet and the “-NotIn” parameter and assign the stated value:


Example 4: Get All Approved Verbs in the Security Group

To retrieve all approved verbs, execute the mentioned command:

Get-Verb | Where-Object Group -EQ Communications

 
In the above-stated code:

    • First, write the “Get-Verb” cmdlet and the “|” pipeline.
    • Then, provide the “Where-Object” and the “Group” cmdlet.
    • Next, place the “-EQ” parameter and specify the stated group name:


That’s all! We have explained the approved verbs for PowerShell commands.

Conclusion

Approved verbs for PowerShell commands are a set of rules that make sure that the specific command follows a specific syntax. It ensures that the specific cmdlet has the verb-noun specific name. This blog described the PowerShell-approved verbs.

About the author

Muhammad Farhan

I am a Computer Science graduate and now a technical writer who loves to provide the easiest solutions to the most difficult problems related to Windows, Linux, and Web designing. My love for Computer Science emerges every day because of its ease in our everyday life.