Pcornel
Automation · Windows Automation

PowerShell

Cheat sheet · https://pcornel.dk/topic.php?topic=5664

Back to the Topic

Answer

PowerShell in Windows Automation uses cmdlets, providers and .NET objects to automate Windows while preserving edition/version, module, object, error-stream, privilege and target-state boundaries.

Remember

  • PowerShell command returned ≠ operation succeeded under non-terminating error semantics.
  • Object emitted ≠ target state changed.
  • Module imported ≠ cmdlet behavior/version is compatible.
  • Local admin membership ≠ current token is elevated.

First checks

  • $PSVersionTable — version
  • Invoke-ScriptAnalyzer — lint
  • Pester tests — quality

Verify in this order

script → cmdlets → Windows

Where it usually breaks

PowerShell execution evidence does not replace target-state or workload verification.

PowerShell automation proof-boundary map

BoundaryHealthy evidenceSuspicious evidence
Scope / identityExact source revision, hosts and execution identity are explicitSelector drift, stale inventory or wrong token changes scope/authority
OperationTool/provider action and per-host result are traceablePartial failure, hidden error semantics or environment differences are lost
Platform statePersistent and effective state are read backCommand/cmdlet success is mistaken for convergence
Workload proofOriginal service/application acceptance passesAutomation summary substitutes for actual runtime behavior

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5664

Confirmation

Confirm action

Continue?