PowerTip: See if You Have a PowerShell Profile

PowerTip: See if You Have a PowerShell Profile

  • Comments 7
  • Likes

Summary: Easily determine if you have a Windows PowerShell profile.

Hey, Scripting Guy! Question I am not sure if I have a Windows PowerShell profile. How can I easily find out?

Hey, Scripting Guy! Answer Use Test-Path and the $profile automatic variable:

Test-Path $PROFILE

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • PowerShell tip: After updating your profile you can reload your profile by calling your $profile using the call operator.

    & $profile

    No need to close and open your profile to see the newly changes made.


  • You might also like this one:
    $PROFILE | gm -MemberType NoteProperty | select -expand Name | % {New-Object PSObject -Property @{PathType=$_; Path=($PROFILE.$_); IsPresent=(Test-Path $PROFILE.$_)}}

  • Just a note: This seems to only cover the shell-specific profile scripts, e.g. either Microsoft.PowerShell_profile.ps1 for "normal" PowerShell or Microsoft.PowerShellISE_profile.ps1 for the ISE, but not profile.ps1 which applies to both (and to any other PowerShell shells you may have).

    For profile.ps1, the most robust alternative I've come up with is a bit ugly:

    Test-Path ([Environment]::GetFolderPath("MyDocuments") + "\WindowsPowerShell\profile.ps1")

  • thank you