Use this branch when you need to understand why PowerShell behaves differently from cmd.exe, choose between Windows PowerShell 5.1 and PowerShell 7, reason about object pipelines, build reusable scripts/functions/modules, or troubleshoot remoting and execution behavior.
PowerShell
PowerShell is an automation shell, scripting language and management framework built around .NET objects. On Windows, distinguish the inbox Windows PowerShell 5.1 product from modern PowerShell 7, which installs side-by-side as pwsh and has a separate support lifecycle.
1. $PSVersionTable — Windows PowerShell 5.1 or PowerShell 7?
2. Get-Command <name> — the command exists in this version?
3. Errors: $Error[0] | fl * -Force.
4. Script blocked? Get-ExecutionPolicy -List.
5. Remote? Test-WSMan <host>.
host and version → module loaded → command found → objects through the pipeline → output or error
Inspect the first unresolved boundary: command resolution, parameter binding, object type, remote/session transport, or target-state verification.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Do not debug PowerShell by reading formatted output as if it were raw data. Do not assume the same command name resolves to the same module/function/alias across hosts. Do not treat a zero-error invocation as evidence that an external dependency or remote target is healthy. Establish the host, command source, input object type and target boundary first.
Operational reference
Fast context before you go deeper.
Select-String -Path <file> -Pattern <text>Primary Commands
Configuration and operational commands for this Topic.
Select-String -Path <file> -Pattern <text>ReferenceSearches files for a text or regular expression pattern, like grep or findstr.
Use when: You need to find an error or a setting in log or configuration files.
Quick note: Use -SimpleMatch for plain text and -Context 2,2 to show lines around the match.
Windows / Windows Server / PowerShell · state · verifies$PSVersionTableReferenceRead current PowerShell state for a bounded verification step.
Use when: Use after confirming the PowerShell & Automation target and before changing state.
Quick note: Windows / Windows Server / PowerShell. A running Windows service or successful cmdlet does not prove effective policy, replication, authorization or remote consumer success.
Windows / Windows Server / PowerShell · mixedVerification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
Capture $PSVersionTable, then resolve commands with Get-Command and inspect objects with Get-Member or direct property access. For state-changing work, capture before-state, invoke the smallest intended change, test $?/errors only as execution evidence, and query the authoritative target state afterward.
Step 2 Operational verification Verify boundary
Object-based command-line administration, remoting, pipelines, modules and repeatable infrastructure automation.
Fast verification
- Use
Get-Command,Get-HelpandGet-Memberto verify command discovery, syntax and object shape.
- Inspect $Error[0], exception details and $LASTEXITCODE when native tools are involved.
- Preserve objects through the pipeline; format only at the presentation boundary.
Evidence · 2 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
The shell host/version, resolved command source, input/output object type and target verification are captured for one operation.
command output · Documented examplePowerShell local healthy-state checkpointThe expected object, scope, state and counters match a controlled test.
Subtopics
Go one level deeper into this subject.
Core PowerShell language and runtime concepts, including hosts, editions, command discovery, help, providers, streams and the object-oriented execution model.
Subtopic CmdletsPowerShell cmdlet model: Verb-Noun naming, parameters, common parameters, parameter sets, binding, ShouldProcess and discoverability.
Subtopic ObjectsPowerShell object model: .NET types, properties, methods, extended type system, calculated properties, serialization and formatting boundaries.
Subtopic PipelinePowerShell pipeline behavior: object streaming, parameter binding, streaming vs collecting, native command boundaries, filtering, projection and formatting.
Subtopic VariablesPowerShell variable semantics: scalar/reference behavior, scope, automatic/preference variables, environment variables, type constraints and lifecycle.
Subtopic ArraysPowerShell array and collection behavior: scalar-vs-array output, indexing, enumeration, unary comma, ArrayList/generic collections and pipeline collection boundaries.
Subtopic Hash TablesPowerShell hash table/dictionary model: key/value storage, ordered dictionaries, splatting, property bags and lookup/mutation behavior.
Subtopic FunctionsPowerShell function model: parameters, advanced functions, pipeline input, Begin/Process/End/Clean, scope, output contracts and ShouldProcess.
Subtopic ModulesPowerShell module packaging and discovery: manifests, script/binary modules, module path, auto-loading, exported commands, dependencies, versions and compatibility.
Subtopic ScriptsPowerShell script execution model: .ps1 files, parameters, scope, invocation operators, dot-sourcing, exit behavior, signing, dependencies and reproducibility.
Subtopic Execution PolicyPowerShell execution policy scopes and precedence on Windows, including Restricted/RemoteSigned/AllSigned/Bypass/Undefined and Group Policy control.
Subtopic ProfilesPowerShell profile scripts: host/user scope combinations, $PROFILE paths, startup customization, reproducibility and profile-related troubleshooting.
Subtopic PowerShell RemotingPowerShell Remoting/PSRP model: one-to-one and one-to-many sessions, WinRM/WSMan on Windows, SSH transport, session configurations, authentication, serialization and authorization.
Subtopic WinRMWindows Remote Management (WinRM) as WS-Management service/transport for Windows PowerShell remoting and other management clients: listeners, service state, authentication, firewall and endpoint boundary.
Subtopic Error HandlingPowerShell error model: terminating vs non-terminating errors, error records, try/catch/finally, ErrorAction, $Error, $? and native-process exit codes.
Subtopic PowerShell TroubleshootingEvidence-first troubleshooting method for PowerShell host/version, command discovery, parameter binding, object pipelines, modules, scripts, remoting, WinRM and error handling.
- PowerShell pipelines normally pass .NET objects, not lines of text.
- Windows PowerShell 5.1 and PowerShell 7 are separate products and can coexist on Windows.
- Cmdlets follow a Verb-Noun naming model and emit typed objects that later commands can inspect or transform.
- Execution policy is a safety feature, not a security boundary.
- Remoting success depends on transport, authentication, endpoint/session configuration and authorization, not merely network reachability.
$PSVersionTable— PowerShell edition and versionGet-Command <name>— which cmdlet/function/exe runsGet-Help <cmdlet> -Full— syntax and parametersGet-ExecutionPolicy -List— execution policy per scope
ReferenceWhat it is3 sections · depth on demand
Operational scope
Object-based command-line administration, remoting, pipelines, modules and repeatable infrastructure automation.
What it is
Object-based command-line administration, remoting, pipelines, modules and repeatable infrastructure automation.
Core model
PowerShell combines a command shell with a scripting language and a rich object model. The defining operational difference from traditional text shells is that PowerShell commands can pass structured objects through the pipeline. Formatting is applied late for display, so what appears on screen is often only a selected view of a richer object.
ReferenceWhy it matters1 section · depth on demand
When to use it
Use PowerShell when the problem concerns Windows Server, PowerShell, identity, policy, networking, roles or event-driven operations.
ReferenceHow it works1 section · depth on demand
How it works
Object-based command-line administration, remoting, pipelines, modules and repeatable infrastructure automation.
ReferenceImportant terms & boundaries2 sections · depth on demand
PowerShell boundary
On Windows, always establish which host you are using. Windows PowerShell 5.1 uses powershell.exe and the full .NET Framework. Modern PowerShell 7 uses pwsh.exe, modern .NET and can run side-by-side. This matters for module compatibility, remoting endpoints, startup profiles and behavior of some cmdlets. Treat product/version as part of evidence, not as decoration.
Key operational limits
- PowerShell returns objects; inspect properties and error records rather than formatted text alone
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in PowerShell. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/powershell/ · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
PowerShell evidence chain
Configuration, operational state, counters and downstream proof remain separate.
| Boundary | Question | Evidence | Does not prove |
|---|---|---|---|
| Definition | What is configured or intended? | running configuration / controller policy | live operation |
| Local state | Is the feature active at the expected scope? | $PSVersionTable | remote success |
| Counters | Did controlled traffic or an event reach this stage? | scoped counters/timestamps | complete return path |
| Next boundary | What consumes or transports this state? | computer/domain context → effective policy/configuration → role/service → dependency/replication/network → event evidence → user/service outcome | application success |
PowerShell reference map
Fast lookup boundaries for PowerShell.
| Item | Meaning | Evidence boundary |
|---|---|---|
| Windows PowerShell 5.1 | Inbox Windows product | powershell.exe; .NET Framework; Windows lifecycle |
| PowerShell 7 | Separate modern product | pwsh.exe; modern .NET; own lifecycle |
| Pipeline | Object transport between commands | successfully receiving an object does not prove downstream state |
| Module | Command packaging/discovery boundary | import/discovery does not prove target operation success |
| Remoting | Remote execution framework | transport reachability does not prove endpoint/authz/function |
Deep reference
Healthy vs suspicious evidence
Output interpretation
Treat pending, requires-reboot, disabled, stopped, degraded, replicating, stale, denied, not-applicable and unknown as distinct from healthy.
Do not map a zero exit code, PowerShell success stream or green MMC icon directly to closure; interpret provider-specific state and any pending action.