Finding All PowerShell Profile Scripts

by Oct 2, 2013

Sometimes it can get confusing which startup scripts run when PowerShell starts. There can be plenty, and they may be different, depending on whether you use the PowerShell console, the ISE, or yet another host.

Knowing about your profile scripts can be extremely important, though. They essentially determine the customizations applied to PowerShell.

The function Get-PSProfileStatus lists all potential startup scripts for the host (PowerShell environment) you run it in. It also reports which profile scripts are really present:

function Get-PSProfileStatus
{
    $profile | 
      Get-Member -MemberType NoteProperty | 
      Select-Object -ExpandProperty Name | 
      ForEach-Object {
        $_, (Split-Path $profile.$_ -Leaf), (Split-Path $profile.$_), 
                              (Test-Path -Path $profile.$_) -join ',' |
          ConvertFrom-Csv -Header Profile, FileName, FolderName, Present
        }
}

Get-PSProfileStatus 

The result could look similar to this:

Pipe it to Out-GridView to see results without truncated lines:

Get-PSProfileStatus | Out-GridView 

Twitter This Tip! ReTweet this Tip!