Pcornel
Windows · PowerShell

Profiles

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

Back to the Topic

Answer

A PowerShell profile is a script that can run when a supported PowerShell host starts. Multiple profile paths can exist for current user/all users and current host/all hosts, and Windows PowerShell and PowerShell 7 can use different profile locations/contexts.

Remember

  • Profiles customize sessions; they should not be hidden production dependencies.
  • $PROFILE exposes the current host/current user path and additional profile-path properties.
  • Different hosts/PowerShell products may load different profile files.
  • Unattended/scheduled/remoting contexts may not load the same profile behavior as an interactive console.
  • -NoProfile is a strong differential test for profile-caused behavior.

First 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

Verify in this order

PowerShell starts → loads AllUsers and CurrentUser profiles → aliases/functions available

Where it usually breaks

First mismatch in definition/configuration → security context → service/task/process creation → runtime state → output/side effect → event/performance evidence; preserve identity/native error/pre-state before mutation.

PowerShell → Profiles reference map

ItemMeaningEvidence boundary
CurrentUserCurrentHostMost specific common profilehost/product-specific path
CurrentUserAllHostsUser-wide customizationstill user-context dependent
AllUsers profilesMachine-level startup customizationrequires managed change control
-NoProfileDifferential startup testdoes not remove other session/environment differences
Explicit module/scriptReproducible dependencypreferred over hidden profile dependency

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

Confirmation

Confirm action

Continue?