Tuesday, February 14, 2012

Handy Profile addition PSISE extension.


For the Microsoft.PowerShellISE_Profile.ps1, this will add a menu item to directly open two of the profile ps1.

# Single quote for first item makes sure that the "$" is included in the menu.
$profileMenu = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('$Profile',$null,$null)
$profileMenu.Submenus.Add("Profile",{$psise.CurrentPowerShellTab.Files.Add($profile.CurrentUserAllHosts)},$null)  | out-null
$profileMenu.Submenus.Add("ISE Profile",{$psise.CurrentPowerShellTab.Files.Add($profile.CurrentUserCurrentHost)},$null)  | out-null

Personally I am replacing the profile variables with production scripts that I manual run if the scheduled run sends me an error email.

$profileMenu = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('$Profile',$null,$null)