PowerShell profiles
suggest changeRemarks
A profile is a PowerShell script that runs when the host starts, so the environment can be prepared for each new session.
Typical things to do at startup:
- import modules used often (ActiveDirectory, Exchange, a specific DLL)
- logging
- changing the prompt
- diagnostics
Several profile files run in a fixed order. Only the current host's profiles run, so the console and ISE rows are alternatives, not six files in one session. These paths are for Windows PowerShell, including the ISE. PowerShell 7 stores current-user profiles under Documents\PowerShell and does not use the ISE profiles.
| Host | User | Path | Start order | Variable |
|---|---|---|---|---|
| All | All | %WINDIR%\System32\WindowsPowerShell\v1.0\profile.ps1 |
1 | $profile.AllUsersAllHosts |
| All | Current | %USERPROFILE%\Documents\WindowsPowerShell\profile.ps1 |
3 | $profile.CurrentUserAllHosts |
| Console | All | %WINDIR%\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1 |
2 | $profile.AllUsersCurrentHost |
| Console | Current | %USERPROFILE%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 |
4 | $profile.CurrentUserCurrentHost |
| ISE | All | %WINDIR%\System32\WindowsPowerShell\v1.0\Microsoft.PowerShellISE_profile.ps1 |
2 | $profile.AllUsersCurrentHost |
| ISE | Current | %USERPROFILE%\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1 |
4 | $profile.CurrentUserCurrentHost |
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents