Profiles
Cheat sheet · https://pcornel.dk/topic.php?topic=3049
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.
$PROFILEexposes 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.
-NoProfileis a strong differential test for profile-caused behavior.
First checks
$PSVersionTable— PowerShell edition and versionGet-Command <name>— which cmdlet/function/exe runsGet-Help <cmdlet> -Full— syntax and parametersGet-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
| Item | Meaning | Evidence boundary |
|---|---|---|
| CurrentUserCurrentHost | Most specific common profile | host/product-specific path |
| CurrentUserAllHosts | User-wide customization | still user-context dependent |
| AllUsers profiles | Machine-level startup customization | requires managed change control |
| -NoProfile | Differential startup test | does not remove other session/environment differences |
| Explicit module/script | Reproducible dependency | preferred 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