Home » PowerShell Tips » PowerShell Approved Verbs

PowerShell Approved Verbs

Approved Verbs in PowerShell follow a specific structure [Verb]-[Noun] to ensure consistency and clarity in PowerShell command syntax.

In PowerShell approved verbs are a verb-noun style format for using names for cmdlets, and functions in PowerShell. The verb specifies an action that the command is doing and the noun part specifies the identity on which action will be performed.

The verb element of an approved verb should be in the infinitive form (like Get, Set, New), while the noun part should be descriptive and singular ( like User, Computer, AdUser).

For example, Get-AdUser (Get – is the verb, AdUser – Noun) cmdlet in PowerShell gets active directory users’ information.

In Windows PowerShell, there are approx. 98 approved verbs, you can get a list of PowerShell approved verbs using Get-Verb cmdlet in PowerShell as below

Get-Verb

Get-Verb cmdlet in PowerShell gets approved verbs as below

PowerShell Approved Verbs
PowerShell Approved Verbs

Note: You can get approved verbs count using Get-Verb | Measure-Object , at the time of post write, the approved verbs count is 98

Let’s understand approved verbs in PowerShell.

PowerShell Approved Verbs Best Practices

Microsoft has created a set of guidelines for approved verbs to use for cmdlets or functions in PowerShell. It ensures consistency between cmdlets or functions created in PowerShell, the purpose of the cmdlets.

Follow PowerShell approved verbs recommendation while creating it as given below

  1. Use approved verbs in PowerShell, you can get an approved verbs list using Get-Verb
  2. Use PowerShell predefined verb for action and noun to identify which action will be performed.
  3. Do not use approved verb synonyms, for example, use the Write verb to write information, and avoid using approved verb synonyms (like put or print).
  4. Use the same approved verb for similar kinds of tasks to maintain consistency.
  5. Use a descriptive noun element that describes the object being acted upon.
  6. Avoid using non-approved verbs

Using the naming convention Verb-Noun pair ensures that commands are easy to understand and the purpose of the cmdlet. For example,

  • Get – This verb is used to retrieve information from a resource. For example, Get-ComputerInfo retrieves information about operating system properties.
  • Set – This verb is used to set information or configuration of a resource. For example, Set-Location set the current working location to a specified location.
  • Remove – This verb is used to remove or delete the resource. For example, Remove-Event deletes the event from the event queue.
  • New – This verb is used to create a new resource. For example, New-LocalUser creates a local user account.

PowerShell Approved Verbs Group

PowerShell has approved verbs for different groups and specifies actions that apply to the group. PowerShell allowed verbs group contains predefined verbs to perform actions.

Common Verbs

Common approved verbs contain predefined verbs to perform generic actions that can be applied to any cmdlet. For example, add, clear, close, get

To get common approved verbs in PowerShell, run the below command

Get-Verb | Where Group -eq "Common" 

The output of the above common verbs are:

PS C:\> Get-Verb | Where Group -eq "Common"                                                                             
Verb     Group
----     -----
Add      Common
Clear    Common
Close    Common
Copy     Common
Enter    Common
Exit     Common
Find     Common
Format   Common
Get      Common
Hide     Common
Join     Common
Lock     Common
Move     Common
New      Common
Open     Common
Optimize Common
Pop      Common
Push     Common
Redo     Common
Remove   Common
Rename   Common
Reset    Common
Resize   Common
Search   Common
Select   Common
Set      Common
Show     Common
Skip     Common
Split    Common
Step     Common
Switch   Common
Undo     Common
Unlock   Common
Watch    Common

Communication Verbs

Communication verbs contain predefined verbs to perform actions that apply to communication. For example, Connect, Disconnect, Send, Receive, etc.

To get communication verbs in PowerShell, run the below command

Get-Verb | Where Group -eq "Communications" 

The output of the above communication approved verbs is:

PS C:\> Get-Verb | Where Group -eq "Communications"                                                                     
Verb       Group
----       -----
Connect    Communications
Disconnect Communications
Read       Communications
Receive    Communications
Send       Communications
Write      Communications


PS C:\>    

Cool Tip: How to rename a computer in PowerShell!

Data Verbs

Data verbs contain predefined verbs to perform actions that apply to data handling. For example, Convert, Save, Edit, etc.

To get data verbs in PowerShell, run the below command

Get-Verb | Where Group -eq "Data" 

The output of the above PowerShell script to get data verbs is:


PS C:\> Get-Verb | Where Group -eq "Data"                                                                               
Verb        Group
----        -----
Backup      Data
Checkpoint  Data
Compare     Data
Compress    Data
Convert     Data
ConvertFrom Data
ConvertTo   Data
Dismount    Data
Edit        Data
Expand      Data
Export      Data
Group       Data
Import      Data
Initialize  Data
Limit       Data
Merge       Data
Mount       Data
Out         Data
Publish     Data
Restore     Data
Save        Data
Sync        Data
Unpublish   Data
Update      Data

Diagnostic Verbs

Diagnostic verbs contain predefined verbs to perform an action that applies to the diagnostics of the resource. For example, Debug, Test, Repair, etc.

To get diagnostic approved verbs in PowerShell, run the below command

Get-Verb | Where Group -eq "Diagnostic" 

The output of the above PowerShell scrip tot get Diagnostic verbs are:

PS C:\> Get-Verb | Where Group -eq "Diagnostic"                                                                         
Verb    Group
----    -----
Debug   Diagnostic
Measure Diagnostic
Ping    Diagnostic
Repair  Diagnostic
Resolve Diagnostic
Test    Diagnostic
Trace   Diagnostic


PS C:\>        

Lifecycle Verbs

Lifecycle verbs contain predefined verbs to perform an action that applies to the lifecycle of a resource. For example, Approve, Disable, Enable, etc.

To get lifecycle approved verbs in PowerShell, run the below command

Get-Verb | Where Group -eq "LifeCycle" 

The output of the above command gets the lifecycle verbs.

PS C:\> Get-Verb | Where Group -eq "LifeCycle"                                                                          
Verb       Group
----       -----
Approve    Lifecycle
Assert     Lifecycle
Complete   Lifecycle
Confirm    Lifecycle
Deny       Lifecycle
Disable    Lifecycle
Enable     Lifecycle
Install    Lifecycle
Invoke     Lifecycle
Register   Lifecycle
Request    Lifecycle
Restart    Lifecycle
Resume     Lifecycle
Start      Lifecycle
Stop       Lifecycle
Submit     Lifecycle
Suspend    Lifecycle
Uninstall  Lifecycle
Unregister Lifecycle
Wait       Lifecycle


PS C:\>      

Security Verbs

Security verbs contain predefined verbs to perform actions that apply to the security of resources. For example, Block, Protect, Unblock, etc.

To get security approved verbs in PowerShell, run the below command

Get-Verb | Where Group -eq "Security" 

The output of the above PowerShell script to retrieve the security verb is:

PS C:\> Get-Verb | Where Group -eq "Security"                                                                           
Verb      Group
----      -----
Block     Security
Grant     Security
Protect   Security
Revoke    Security
Unblock   Security
Unprotect Security


PS C:\>         

Other Verbs

Other verbs contain predefined verbs that do not cover any of the above-mentioned categories. For example, use

Get-Verb | Where Group -eq "Other" 

The output of the above command is:

PS C:\> Get-Verb | Where Group -eq "Other"                                                                              
Verb Group
---- -----
Use  Other


PS C:\>    

Cool Tip: How to get computer information of remote computers in PowerShell!

PowerShell Function Naming Convention

The PowerShell function name should be descriptive and provides a clear idea of what the function does. While naming the function in PowerShell follow approved verbs best practice.

Here are some of the best practices to follow for the PowerShell function name.

  1. Use Verb-Noun pairs – PowerShell commands follow a pattern of verb-noun where the verb element describes the action that the command performs, while the noun describes the identity on which action will be performed. For example, Remove-Item, Get-Process, etc…
  2. Use PascalCase: The function name in PowerShell should follow PascalCase, which means that the first letter of each word should be capitalized. For example, Get-Process, and Get-AdUser.
  3. Avoid abbreviations – Use descriptive words to describe the noun part in the function name. The function name should be concise and easy to remember.

Conclusion

I hope the above article on PowerShell approved verbs is helpful to you to write your cmdlet or function as per verb-noun format.

It is best practice to use approved verbs while writing cmdlet and avoid using approved verbs synonyms in PowerShell. Using PowerShell approved verbs is an important best practice to ensure code consistency, syntax, and code is easy to understand and maintain.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.