In this tutorial we will show you how to create, remove, and manage PowerShell profiles.
PowerShell profiles overview
A PowerShell profile is a PS1 script that runs automatically when the powershell.exe (pwsh.exe) shell (console) is started. PowerShell profiles act as logon scripts that configure the user’s environment and customize the appearance and behavior of the shell. In your PowerShell profile, you can add custom aliases for frequently used cmdlets, custom functions, variables, automatically import third-party modules or snap-ins.
A PowerShell profile file can be created only for the current user or for all users and applications on a computer. This command lists the available profile files for a user:
$profile | select *

Available PowerShell profiles
| Profile | Description | Profile location | Command to open |
| AllUsersAllHosts | General settings applied for all users | $PsHome\profile.ps1 | $profile.AllUsersAllHosts |
| AllUsersCurrentHost | Settings specific to apps that start PowerShell | $PsHome\Microsoft.PowerShell_profile.ps1 | $profile.AllUsersCurrentHost |
| CurrentUserAllHosts | Use when you have different programs running PowerShell, but you want to have the same environment settings in each session. | $Home\Documents\WindowsPowerShell\profile.ps1 | $profile.CurrentUserAllHosts |
| CurrentUserCurrentHost | User-specific settings | $Home\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 | $profile |
Note. The paths shown in the table are for Windows PowerShell 5.1. In PowerShell 7+, user profiles use Documents\PowerShell instead of Documents\WindowsPowerShell. Use $PROFILE to determine the exact path for the current PowerShell host.
The following environment variables are used:
- $Home โ contains the path to the current user’s home directory (for example, C:\Users\sysops).
- $PsHome โ path to the PowerShell installation directory (default C:\Windows\System32\WindowsPowerShell\v1.0).
Creating profile for current user and editing
By default, PowerShell profile files are not created in Windows. To create a profile file for the current user (CurrentUserCurrentHost), run the command:
New-Item -Path $profile -ItemType File -Force
This will create a file named Microsoft.PowerShell_profile.ps1 in the current user’s profile directory.

To edit a profile using a simple Notepad app, run the command:
notepad.exe $profile
To open a profile file in the built-in PowerShell ISE editor:
ise $profile
Note. PowerShell ISE is available only in Windows PowerShell 5.1 and isn’t included with PowerShell 7+.
Add PowerShell code to profile file
Now you can add your PowerShell code to the profile file. Let’s try to customize how the PowerShell console looks: change the colors, the console title, add an alias and a simple function.
# Change folder
Set-Location C:\
# Change windows title:
$host.UI.RawUI.WindowTitle = "MyShell"
# Console window size
$Shell = $Host.UI.RawUI
$Size = $Shell.WindowSize
$Size.Width = 120
$Size.Height = 40
$Shell.WindowSize = $Size
# Change background and font color
$Shell.foregroundcolor = "Green"
$Shell.backgroundcolor = "Black"
# Create a new alias for the app (command):
Set-Alias np "C:\Windows\System32\notepad.exe"
# Let's add a simple function that displays the last 10 commands from the PowerShell console history
function h10 { Get-History -Count 10 }
# Clean Screen
Clear-Host
# Display welcome message
"Welcome: " + $env:Username
Save the profile file.

Make sure that current PowerShell Execution Policy doesnโt block profile file
Because the PowerShell profile is a .ps1 script, its execution can be affected by the PowerShell execution policy. You need to check the effective policy before changing it:
Get-ExecutionPolicy
If the result is Restricted and you want to allow your current user to run PowerShell scripts, you can set the policy to RemoteSigned for the current user using the command below:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Note. The default execution policy can vary between Windows client and Windows Server installations and may also be controlled by Group Policy. On systems where the effective policy is already RemoteSigned/less restrictive, this step may not be necessary. If MachinePolicy/UserPolicy is configured, a Group Policy setting can override the CurrentUser setting.

Re-open the PowerShell console. Verify that its appearance has changed and that it matches the settings that you set in the PowerShell profile file.

In addition to the default profiles, some apps that use PowerShell can have their own profiles. For example:
- Visual Studio Code (VSCode) โ $HOME\ Documents\ PowerShell\ Microsoft.VSCode_profile.ps1
- PowerShell ISE โ $HOME\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1
Run script without applying profiles
A PowerShell profile can greatly enhance your console experience by customizing and streamlining your working environment. Keep in mind, however, that adding a lot of code to PowerShell profiles can significantly slow down the startup of the powershell.exe console and the time it takes for PowerShell scripts to run through the Task Scheduler. To open a PowerShell console or run a script without applying profiles, add the -NoProfile parameter to the command:
PowerShell.exe -noprofile
Delete PowerShell profile
Make sure the profile file exists before removing it!
Remove-Item -Path $profile
Note. This command removes the current user’s PowerShell profile file. The profile will no longer be loaded when PowerShell starts unless you create it again.
What is a PowerShell profile?
A PowerShell profile is a .ps1 script file that runs automatically when powershell.exe or pwsh.exe starts. It is used to customize the PowerShell environment by adding aliases, functions, variables, module imports, and other startup settings.
What can you use a PowerShell profile for?
A PowerShell profile can be used to:
- Create custom aliases for frequently used commands.
- Add custom PowerShell functions.
- Define environment variables.
- Import PowerShell modules automatically.
- Customize the PowerShell console appearance.
- Configure the shell behavior for interactive sessions.
Can a PowerShell profile slow down PowerShell startup?
Yes. A profile that contains many commands, module imports, or complex functions can increase PowerShell startup time.
Keep profiles lightweight, especially on systems where PowerShell is used for automation, scheduled tasks, or scripts.
What is the difference between PowerShell profiles and scripts?
A PowerShell script is executed manually or by automation, while a PowerShell profile runs automatically every time a PowerShell session starts. Profiles are mainly intended for customizing the interactive PowerShell environment.

