PowerShell for Windows Admins

Nov 23 2017   9:09AM GMT

PowerShell v6: #4 profiles

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Tags:
Powershell

Windows PowerShell (v1-v5.1) has always used profiles to configure your PowerShell session. You need execution policy set to something other than restricted so that the profile script can run.

You can have up to 4 profiles:

Description                   Path
 -----------                  ----
 Current User, Current Host   $Home\[My ]Documents\WindowsPowerShell\Profile.ps1
 Current User, All Hosts      $Home\[My ]Documents\Profile.ps1
 All Users, Current Host      $PsHome\Microsoft.PowerShell_profile.ps1
 All Users, All Hosts         $PsHome\Profile.ps1

Most people only use 1. I use $Home\[My ]Documents\Profile.ps1 as my profile as its easier to change then in $PShome.

In PowerShell v6 your profile options are
 Description                   Path
 -----------                   ----
 Current User, Current Host    $Home\Documents\PowerShell\Profile.ps1
 Current User, All Hosts       $Home\Documents\Profile.ps1
 All Users, Current Host       $PsHome\Microsoft.PowerShell_profile.ps1
 All Users, All Hosts          $PsHome\Profile.ps1

The location of $PShome changes in PowerShell v6. In Windows PowerShell v1 through v5.1 its:

PS> $pshome
C:\Windows\System32\WindowsPowerShell\v1.0

In PowerShell v6 its:

PS C:\scripts> $pshome
C:\Program Files\PowerShell\6.0.0-beta.9

Be careful of using $Home\Documents\Profile.ps1 as it will also be applied to Windows PowerShell. The safest place to put your PowerShell v6 profile is $Home\Documents\PowerShell\Profile.ps1 as it will still apply when you upgrade to the next version e.g. from a beta version to release candidate or full release.

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: