PowerShell: Profile (init file)

By Xah Lee. Date: . Last updated: .

What is PowerShell Profile

PowerShell profile are files PowerShell loads when starting up. It can contain your own functions, alias, or other customization.

Profile Location

All Users, All Hosts

$PSHOME\Profile.ps1

All Users, Current Host

$PSHOME\Microsoft.PowerShell_profile.ps1

Current User, All Hosts

$Home\Documents\PowerShell\Profile.ps1

Current user, Current Host

$Home\Documents\PowerShell\Microsoft.PowerShell_profile.ps1

Just create the file, and add Function or Alias or other PowerShell code to the file.

Profile Path Variable

Profile paths are stored in the variable $PROFILE. In particular, in the NoteProperty.

To list profile paths, do

$PROFILE | Get-Member -Type NoteProperty | Format-List
PowerShell profile 2022-06-13 b4gVY
PowerShell profile 2022-06-13

Start PowerShell Without Loading Profile

pwsh -NoProfile

Show PowerShell Command-Line Options

pwsh -h

or

pwsh -?

PowerShell: Profile and Script