PowerSE 2.7 KB: PowerShell profile does not load on startup

Note: This blog post refers to an issue identified in PowerSE 2.7.0. It has been corrected in PowerSE 2.7.1, which is now available.

With the release we published yesterday, both PowerSE and PowerWF received a new feature: product-specific profiles.  This feature allows you to have profile scripts that you only want run in PowerSE or PowerWF run there so that you don’t have to use if statements to check the host name in your profile scripts.  With this feature we also created the initial PowerSE and PowerWF profile scripts such that they dot-source the native PowerShell profile script by default so that what runs in PowerShell also runs in PowerSE.

Unfortunately there is one small detail that was left out of the PowerSE installer for this feature: the installation of the initial PowerSE-specific profile. As a result, if you download PowerSE 2.7, your PowerShell profile won’t run right away.  Fortunately the fix is simple.  All you need to do is invoke this script from inside PowerSE 2.7:

if (-not (Test-Path -LiteralPath $profile)) {
    Set-Content -Path $profile -Value @’
if (Test-Path -LiteralPath $profile.CurrentUserPowerShellHost) {
    . $profile.CurrentUserPowerShellHost
}
‘@
}

Once you have run that script, your PowerSE profile will exist and it will be defined to load your PowerShell profile.  Restart PowerSE 2.7 and you’ll have your PowerShell profile loaded by default again.

Note that this does not apply to PowerWF users, the profile scripts were added correctly to the installer for that release.

My apologies for the inconvenience.  We hope to have this resolved in the product itself very soon.  In the meantime this short script should work around the issue for you.

Kirk out.

Advertisements

One thought on “PowerSE 2.7 KB: PowerShell profile does not load on startup

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s