PowerShell Approved Verbs Skill
Overview
System Optimizer requires strict adherence to PowerShell approved verbs for all cmdlet naming. This ensures compatibility with PSScriptAnalyzer and follows PowerShell best practices.
Approved Verbs by Category
Common Verbs (Most Used)
- •
Get-- Retrieves data - •
Set-- Changes data or settings - •
Test-- Verifies conditions (replaces "Verify", "Check") - •
Show-- Displays information (replaces "Preview", "Display") - •
Start-- Begins an operation - •
Stop-- Ends an operation - •
New-- Creates new items - •
Remove-- Deletes items - •
Invoke-- Executes actions (replaces "Run", "Execute")
Verbs to AVOID
| Avoid | Use Instead |
|---|---|
Apply- | Set- |
Verify- | Test- |
Preview- | Show- |
Schedule- | Set- |
Cancel- | Stop- |
Ensure- | Set- or Test- |
Run- | Start- or Invoke- |
Compare- | Use Get- and compare results |
When Creating Functions
- •Check verb approval: Run
Get-Verbin PowerShell to see approved verbs - •Choose the right category: Use Data, Lifecycle, or Diagnostic verbs appropriately
- •Use singular nouns:
Get-UsernotGet-Users
Fixing Existing Code
When renaming functions:
- •Update function definition
- •Update all internal calls
- •Update Export-ModuleMember
- •Update FunctionModuleMap in Start-SystemOptimizer.ps1
- •Update documentation headers
- •Update any external references
Example Renames
powershell
# Before
function Apply-WinUtilServiceConfig { }
function Preview-WinUtilServiceChanges { }
function Schedule-ShutdownAtTime { }
function Cancel-AllScheduledShutdowns { }
# After
function Set-WinUtilServiceConfig { }
function Show-WinUtilServiceChanges { }
function Set-ShutdownAtTime { }
function Stop-ScheduledShutdown { }