If you use the PowerShell ISE as your primary script editor, you might want to tweak it a bit. The first thing you'll need is your ISE profile script. If it doesn't exist, you'll need to create. PowerShell will look for file C:\Users\USERNAME\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1 (on Windows 7 anyway). Any commands you put in this file will be applied to your ISE session.
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
This is where you can take advantage of the ISE object model. I like to configure my font.
[cc lang="PowerShell"]
#configure the console
$psise.options.fontsize=16
$psise.options.fontname="Consolas"
[/cc]
You can also add items to the menu like my Most Recent Files. One other menu choice I've added recently is Open Script Folder. This line of code will open the folder of the current script in Windows Explorer. Handy when you want to do something with the file itself or other files you know are in the same folder. To add his feature, include this line in your ISE profile.
[cc lang="PowerShell"]
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add("Open Current Script Folder",{Invoke-Item (split-path $psise.CurrentFile.fullpath)},"ALT+O") | out-Null
[/cc]
I pipe to Out-Null purely for cosmetic reasons so I don't see the command in the results pane when I start the ISE. My menu choices uses the ALT+O shortcut. You can change it if you want. The next time you start the ISE you should get these options.
Enjoy.
Here’s one I noticed in some of the demos at TechEd 2010, change the OutputPane to look more console-like:
$psISE.Options.OutputPaneBackgroundColor = ‘#FF000000’
$psISE.Options.OutputPaneTextBackgroundColor = ‘#FF000000’
$psISE.Options.OutputPaneForegroundColor = ‘#FFFFFFFF’