Pcornel
Browse topics
Options
Recent
Favorites
Windows · Technical reference

PowerShell Troubleshooting

Direct answer

PowerShell troubleshooting checks the PowerShell version and exact command line first, then whether the right command and module were loaded, what input it received, and the full error record ($Error[0] | Format-List * -Force), instead of changing syntax at random.

When to use this

Use this topic when a script/command works on one machine but not another, output differs from expectation, cmdlets are missing, pipelines fail, execution policy blocks loading, remoting fails, or a command reports success but the target does not behave correctly.

First 30 seconds

1. $PSVersionTable — version on both machines.

2. Get-Command <name> — same command and module?

3. $Error[0] | fl * -Force — full error.

4. Run with -Verbose / Set-PSDebug -Trace 1.

5. Compare with pwsh -NoProfile to exclude profile effects.

Operational verification

version → module/command resolution → parameters → execution → error details

Evidence · next step

Perform the narrow next test inside the failed boundary, then rerun end-to-end verification after remediation.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common traps

Avoid reinstalling PowerShell or resetting WinRM as first steps. Avoid broad ExecutionPolicy/TrustedHosts changes. Do not stringify object pipelines to “make them work” before proving the original type/binding mismatch. Do not discard full error records.

Platform / version applicability
Windows execution, automation and observability
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformWindows execution, automation and observability
Scope / prerequisiteUse this topic when a script/command works on one machine but not another, output differs from expectation, cmdlets are…
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

3 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Verification path Verify boundary

Use differential tests: -NoProfile, a clean shell, explicit module import, one representative object, local vs remote, Windows PowerShell vs PowerShell 7 only when compatibility is in question. Change one variable at a time and preserve before/after evidence.

Step 2 Known-good, broken and when it is fixed Verify boundary

Known-good means the script/module runs in the actual target host/session with expected object types, exit/error behavior and intended side effect, then succeeds again in the original automation path. Broken evidence is host/module mismatch, parameter/type error, remoting/session constraint or an unhandled nonterminating error that leaves partial state. The limit of what it shows is not absence of red text; explicitly validate output objects, $?/exit semantics where relevant and the resulting system state.

Step 3 Native failure isolation and next-check logic Narrow the fault

Capture the exact error record including exception, category, fully qualified error ID and position rather than only the red message. Confirm PowerShell edition/version, module command resolution and parameter types; use $Error[0]/verbose/debug or transcript/logging as appropriate. If remote or scheduled execution differs, compare identity, session configuration, environment and filesystem/network access. Reduce the failing pipeline to the smallest object-producing step so formatting output is not mistaken for underlying data.

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Always capture the exact PowerShell product/version before comparing systems.
  • Command name alone is insufficient evidence; resolve source/module/type.
  • Object type and pipeline binding are stronger evidence than formatted screen output.
  • Execution policy, WinRM transport, remoting endpoint and target authorization are distinct layers.
  • “No PowerShell error” is not the same as “desired target state verified.”
Key checks
  • $PSVersionTable — PowerShell edition and version
  • Get-Command <name> — which cmdlet/function/exe runs
  • Get-Help <cmdlet> -Full — syntax and parameters
  • Get-ExecutionPolicy -List — execution policy per scope
ReferenceWhat it is1 section · depth on demand

Core model

Troubleshooting should begin by freezing context: exact command/script, timestamp, user, host, $PSVersionTable, working directory, profile state and module/command source. This prevents a session-dependent difference from being mistaken for a code defect.

ReferenceHow it works1 section · depth on demand

How it works

PowerShell execution depends on host/version, module discovery, execution policy/signing, language mode, session scope, remoting context, object types and the underlying .NET/native command behavior. Text that looks correct can still have type, quoting, pipeline or scope differences. A script that works interactively may fail under Task Scheduler, WinRM or service automation because identity, profile, working directory and environment differ.

ReferenceImportant terms & boundaries3 sections · depth on demand

PowerShell boundary

Then classify the failure point. Parse/binding failures happen before command action. Module/command discovery failures are local session problems. Remoting failures require transport/auth/endpoint separation. Native-process failures need exit-code handling. A state-changing command with clean output still requires a target query.

In depth

Execution policy — why a script will not run

PS C:\> Get-ExecutionPolicy -List
        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy       AllSigned
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser    RemoteSigned
 LocalMachine    RemoteSigned

The first defined scope from the top wins; Group Policy (MachinePolicy/UserPolicy) overrides Set-ExecutionPolicy. Downloaded scripts carry a Zone.Identifier mark: under RemoteSigned they need a signature or Unblock-File. Execution policy is a safety feature, not a security boundary.

See the real error

$Error[0] | Format-List * -Force
$Error[0].InvocationInfo.PositionMessage
$Error[0].Exception.GetType().FullName
Get-Error            # PowerShell 7: full error with inner exceptions

Make failures stop the script

SettingEffect
$ErrorActionPreference = 'Stop'Non-terminating errors become terminating — try/catch works
-ErrorAction Stop on a cmdletSame, for one call
Set-StrictMode -Version LatestErrors on undefined variables and properties
$LASTEXITCODEExit code of native programs (robocopy, git) — not covered by try/catch

Version and host differences

ProblemCheck
Cmdlet missing$PSVersionTable; Windows PowerShell 5.1 vs PowerShell 7 module compatibility
Module not foundGet-Module -ListAvailable Name; $env:PSModulePath differs between users and services
Works interactively, fails as a scheduled taskProfile not loaded, different user, working directory, 32-bit host (SysWOW64)
Output truncated in logsFormat cmdlets in pipelines; use Out-String -Width 4096 or export to CSV/JSON

Record what happened

Start-Transcript -Path C:\Logs\job-$(Get-Date -f yyyyMMdd-HHmm).txt
...
Stop-Transcript

For security monitoring enable Script Block Logging via GPO (event 4104 in Microsoft-Windows-PowerShell/Operational), which records the code that actually ran.

*The execution-policy table illustrates scope precedence and is not a policy read-back from a real workstation.*

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Method

PowerShell troubleshooting deals with scripts that fail, behave differently in different hosts, or cannot run because of policy.

$PSVersionTable
Get-ExecutionPolicy -List
$Error[0] | Format-List * -Force
Set-PSDebug -Trace 1
Set-StrictMode -Version Latest
Get-Module -ListAvailable ActiveDirectory
Start-Transcript -Path C:\Temp\run.log
SymptomCause
"running scripts is disabled"Execution policy
Works in ISE/VS Code, fails in schedulerDifferent user, working directory, profile, 32/64-bit host
Cmdlet not foundModule missing or PowerShell 5.1 vs 7 differences
try/catch does not catchNon-terminating error — use -ErrorAction Stop
Remote command failsWinRM, double-hop credentials

Run scheduled scripts with pwsh -NoProfile -File and log with transcripts to see exactly what happened.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docWindows execution, automation and observability current

Authoritative/upstream documentation reviewed for bounded claims in PowerShell → PowerShell Troubleshooting. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://learn.microsoft.com/en-us/powershell/ · confidence 94%
Terminology layer

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.

Aliases that resolve here
powershell troubleshootingdebug powershell commandpowershell works on one machine not anotherpowershell script troubleshooting
Embedded reference data

Quick lookup tables

PowerShell → PowerShell Troubleshooting reference map

Fast lookup boundaries for PowerShell → PowerShell Troubleshooting.

ItemMeaningEvidence boundary
Host mismatchpowershell.exe vs pwsh.exe/versionchanges runtime/modules/behavior
Command mismatchalias/function/cmdlet/module/nativesame name can resolve differently
Object/binding mismatchwrong type/property/cardinalitypipeline may fail before target
Remote mismatchtransport/auth/endpoint/authzmust isolate layer
Target mismatchcommand completed; state wrongrequires independent verification
Confirmation

Confirm action

Continue?