A PowerShell profile is a script that runs when PowerShell starts. To manage one, inspect $PROFILE in the host where you want the customization, choose the right user and host scope, create the file if it does not exist, then edit it and restart PowerShell.
What a PowerShell profile does
A profile is a script file for startup customization. It can define aliases, functions, variables, load modules, create PowerShell drives, run commands, and set preferences. PowerShell does not create profile files automatically. Microsoft’s about_Profiles documentation describes how the files are named, located, and loaded.
Choose the right profile scope
PowerShell provides four profile paths: two user scopes (current user or all users) crossed with two host scopes (current host or all hosts). The profile you choose determines who receives the customization and where it applies.
| Profile | Applies to | Typical use |
|---|---|---|
CurrentUserAllHosts |
Your account in all PowerShell hosts | Personal functions or aliases you want in more than one host |
CurrentUserCurrentHost |
Your account in the current host only | Host-specific settings, such as console appearance |
AllUsersAllHosts |
All users in all hosts | Common settings managed for a machine |
AllUsersCurrentHost |
All users in the current host only | Host-specific settings managed for a machine |
The current-user/current-host path is stored directly in $PROFILE. The other paths are available as properties, including $PROFILE.CurrentUserAllHosts and $PROFILE.AllUsersAllHosts. To inspect all paths for the host you are currently using, run:
#1 Best Overall
- Book - powershell for sysadmins: workflow automation made easy
- Language: english
- Binding: paperback
$PROFILE | Select-Object *
Run that command separately in each host application where you want the customization. A PowerShell console and Visual Studio Code can have different host-specific profile files, and paths can vary by operating system and installation. Microsoft documents default current-user paths as follows:
| Platform | CurrentUserAllHosts |
Standard current-user/current-host console profile |
|---|---|---|
| Windows | $HOMEDocumentsPowerShellProfile.ps1 |
$HOMEDocumentsPowerShellMicrosoft.PowerShell_profile.ps1 |
| Linux | ~/.config/powershell/profile.ps1 |
~/.config/powershell/Microsoft.PowerShell_profile.ps1 |
| macOS | ~/.config/powershell/profile.ps1 |
~/.config/powershell/Microsoft.PowerShell_profile.ps1 |
These are documented defaults, not a substitute for checking your actual paths. On Windows, redirected Documents folders or OneDrive can change the location. The all-users paths are under $PSHOME. See Microsoft’s profile path reference for details.
Create and edit a profile
Use the profile path for the scope you selected. This pattern creates the current-user/current-host profile only when it is missing, avoiding accidental replacement of an existing file:
if (!(Test-Path -Path $PROFILE)) {
New-Item -ItemType File -Path $PROFILE -Force
}
Recommended Free Tools
Rank #3
For another scope, replace $PROFILE with the matching property, such as $PROFILE.CurrentUserAllHosts. On Windows, Microsoft’s example for opening the current profile in Notepad is notepad $PROFILE; you can use another text editor appropriate to your system. Save the file, then restart PowerShell for the startup script to run.
Profiles contain executable startup code, so add only commands you understand and intend to run. If startup becomes slow or fails after an edit, review recent changes. For a diagnostic session that skips profiles, launch PowerShell with:
Rank #4
pwsh -NoProfile
Troubleshoot a profile that does not load
Check the path and host
Confirm the file exists at the path reported by $PROFILE in the host where you expect it to run. A profile created for one host may not run in another; inspect the paths again in the second host.
Check execution policy on Windows
On Windows, execution policy can prevent profile scripts from running. Inspect the effective policy with Get-ExecutionPolicy, or examine each scope and its precedence with Get-ExecutionPolicy -List. Group Policy scopes can control the effective result. Microsoft notes that “The execution policy isn’t a security boundary, it’s defense in depth.” Treat it as a safeguard against unintentional script execution, not as a replacement for security controls. See about_Execution_Policies for policy behavior and scopes.
Best Value
Execution policy does not apply to PowerShell on macOS or Linux, so Windows policy troubleshooting does not apply on those systems.
Account for remote sessions
Profiles do not run automatically in remote sessions, and $PROFILE is not populated there. Microsoft documents invoking a local profile file in a session or dot-sourcing an explicit profile path on the remote computer when you need those customizations remotely. See about_Profiles for the documented approaches.
Special case: MSIX installations
For MSIX-based PowerShell installations, all-users profiles would need to be stored under $PSHOME, but that package location is read-only. Microsoft therefore documents using current-user profiles for customization with these installations rather than all-users profiles. Consult Microsoft’s profile documentation for installation-specific details.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →




