Skip to content

Cmdlets

Discovery and learning:

  • Get-Command [-Name Verb-*]: Filter by verb
  • Get-Help CommandName -Examples: View examples (e.g., Get-Help Get-Process -Examples)
  • Get-Help about_*: Read built-in help topics (about_*)

Naming convention: Verb-Noun, common verbs include Get/Set/New/Remove/Start/Stop/Invoke/Test, etc. Use Get-Verb to view recommended verb list.

Common Parameters: Almost any supported cmdlet can use -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable, etc.

Examples:

powershell
Get-Command -Verb Get -Noun Process
Get-Process -Name pwsh | Stop-Process -WhatIf  # Preview, doesn't actually execute

Aliases:

  • ls/dir/gci -> Get-ChildItem
  • cat/type/gc -> Get-Content
  • % -> ForEach-Object, ? -> Where-Object

Recommendation: Avoid aliases in scripts to ensure readability and portability.

Content is for learning and research only.