Coding Ref

What are verbs in PowerShell?

What are verbs in PowerShell?

In PowerShell, verbs are used to describe the action that a cmdlet or function performs.

For example, the Get-ChildItem cmdlet uses the verb Get to describe its action of retrieving child items, and the Stop-Service cmdlet uses the verb Stop to describe its action of stopping a service.

According to the PowerShell verb naming conventions, verbs should be written in singular form and in uppercase letters.

Approved verbs in PowerShell

Here is a complete list of approved verbs that can be used in cmdlets and functions.

  • Add
  • Clear
  • Close
  • Copy
  • Debug
  • Disable
  • Disconnect
  • Enable
  • Export
  • Find
  • Format
  • Get
  • Hide
  • Import
  • Install
  • Invoke
  • Join
  • Limit
  • Lock
  • Measure
  • Move
  • New
  • Open
  • Optimize
  • Out
  • Ping
  • Pop
  • Push
  • Redo
  • Register
  • Remove
  • Rename
  • Repair
  • Request
  • Reset
  • Resize
  • Resolve
  • Restart
  • Restore
  • Resume
  • Revoke
  • Save
  • Search
  • Select
  • Set
  • Show
  • Skip
  • Split
  • Step
  • Stop
  • Submit
  • Suspend
  • Switch
  • Sync
  • Test
  • Unblock
  • Undo
  • Uninstall
  • Unlock
  • Unregister
  • Update
  • Use
  • Wait
  • Watch

Why does PowerShell have approved verbs?

PowerShell has approved verbs to ensure consistency and clarity in the names of cmdlets and functions. By using approved verbs, we can easily understand the actions that cmdlets and functions perform, and can more easily use and manage the commands in their scripts and applications.

For example, if a cmdlet uses the verb Get in its name, it is clear that the cmdlet is intended to retrieve information or objects. Similarly, if a function uses the verb Set in its name, it is clear that the function is intended to change or set values for objects or variables.

By using approved verbs, PowerShell cmdlets and functions can be more easily understood and used by users, and can be more easily integrated into scripts and applications.

Conclusion

In PowerShell, verbs are used to describe the action that a cmdlet or function performs.

You'll also like

Related tutorials curated for you

    How to sort and filter data in PowerShell

    What are verbs in PowerShell?

    What is a PowerShell Hashtable?

    How to add a user to a group in PowerShell

    How to copy and paste into PowerShell

    What are the different PowerShell file types?

    How to order a hashtable in PowerShell

    What is PowerShell Grep?

    While loops in PowerShell

    Substrings in PowerShell

    How to use SFTP in PowerShell

    Not equal to in PowerShell