Can PowerShell ISE run with a specified profile (not the default)?
I want to have multiple (more than one) PowerShell profiles that will create different environments.
Specifically, I need a way to run a separate PowerShell ISE to work with TFS and another instance of PowerShell ISE for regular use. The "TFS" environment requires loading some additional snappins, modules, changes, etc. I don't want all of this stuff to run for regular PowerShell ISE sessions, but only when I want to.
I found that I can automatically load an arbitrary script via the -File command line parameter, but it doesn't get executed automatically.
source to share
I do this by creating a shortcut for PowerShell ISE with a standard directory:
In the default directory (here D: \ TFS), I create a file .PS1
named local_profile.ps1
.
At the beginning of the current profile file ( C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
) I add:
# Try to load local profile
Get-ChildItem "local_profile.ps1" -ErrorAction SilentlyContinue | %{.$_}
You just need to add your init code to D:\TFS\local_profile.ps1
.
source to share
powershell ISE also has a profile.
Perhaps it is something like: E:\Users\UserName\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1
Or you can open powershell ise and look at the variable $profile
.
After finding the profile file, write your import modules and custom scripts in it.
source to share