While at TechEd last week, PSEdit was used in one of the PowerShell sessions that I sat through. Afterwards a couple of friends asked me if I had ever heard of it and said they hadn’t so I thought I would write a blog article about it to help spread the word.
PSEdit is a function that only exists in the PowerShell ISE. Type in PSEdit followed by the name of a PowerShell script and that script will be opened in a new tab in the ISE:
Try the same thing in the PowerShell console and you’ll end up with an error message:
Since psEdit is a function and not a compiled cmdlet, you can take a look under the covers to see what it does behind the scenes:
Get-Command -Name psEdit | Select-Object -ExpandProperty Definition
There’s very little help for psEdit and this is even after running Update-Help from within the PowerShell ISE:
Even though the filenames parameter doesn’t show it accepting an array , based on the code and a little testing, a common separated list can be used to open multiple scripts:
psEdit -filenames '.\Get-FSMORole.ps1', '.\Get-Top10PRocesses.ps1'
I’ve actually written a previous blog article to locate and open scripts in the PowerShell ISE that uses the same behind the scenes code as psEdit that you may also find interesting.