PowerShell profiles

PowerShell profiles

posted in dev-setup on • last updated on

Reload PowerShell profile

. $profile

PowerShell Core

The default location changed in PowerShell Core to

$home\Documents\PowerShell

PowerShell

Profile locations

# executes automatically
$home\Documents\WindowsPowerShell\profile.ps1

# executes with console host only
$home\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

# executes with ISE only
$home\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1

# Visual Studio Package Manager Console
$home\Documents\WindowsPowerShell\NuGet_profile.ps1

When . $profile doesn’t quite cut it.

function Reload-Profile {
	@(
		$Profile.AllUsersAllHosts,
		$Profile.AllUsersCurrentHost,
		$Profile.CurrentUserAllHosts,
		$Profile.CurrentUserCurrentHost
	) | % {
		if (Test-Path $_) {
			Write-Verbose "Reloading $_"
			. $_
		}
	}
}

Updates
  • 4 September 2018 : Updated locations for PowerShell Core
Tags: powershell windows