Site icon PowerShell is fun :)

Using PSEdit as PowerShell editor

I like using Visual Studio Code as my PowerShell script editor, but alternative editors exist. The built-in PowerShell ISE is usually there for you on Windows, but there’s a nice PowerShell module that you can use called PSEdit. In this blog post, I will show you how to use that as an alternative to VSCode.

What is PSEdit?

It’s a PowerShell module that you can install to edit scripts in your PowerShell terminal with the following features:

PSEdit is created and maintained by Ironman Software open-source projects. Visit them on their GitHub page here.


You can install the module by running the following:

Install-Module psedit

Using PSEdit

Opening files

After installing the module, you can use PSEdit to edit a file by running the following:

Show-PSEditor -Path .\file.path

Or you can start PSEdit by running Show-PSEditor and using File, Open to browse your script.

In the example below, I used PSEdit to edit my Export-Registry function:

As you can see, it has color coding and looks pretty nice 🙂

Editing files

When editing a file, PSEdit will use IntelliSense to autocomplete things, for example:

It will also highlight any incomplete parts or errors. In the example below, the bracket { is missing, and it highlights that in red:

It can also format your script if you have the PSScriptAnalyzer module installed (Install using Install-Module PSScriptAnalyzer followed by import-module PSScriptAnalyzer if not)

In the unformatted example below, for example:

PSEdit will change to this when using Edit, Format (CTRL-SHIFT-R):

It also has mouse support, which you can use to control the Menu. Right-Click will give you these options:

Running PowerShell code

You can execute the whole PowerShell script using Debug, Run (F5), or a selection (You can hold Shift and select multiple lines) by Debug, execution selection (F8). You can also run and exit PSEdit by using Debug, Exit and Run in Console (CTRL-SHIFT-F5)

Note: Write-Host output won’t show on the output screen. Write-Output does work

Any errors can be viewed by using View, Errors. Syntax errors can be displayed using View, Syntax Errors.

Is it better than VSCode or ISE?

It’s a lightweight alternative that is easy to use and doesn’t require any installation in Windows or MacOS other than installing the module itself. The benefit of PSEdit is that it can also run on Windows Server Core, in which you can’t use GUI apps, but you can also use it in a Linux shell if you have powershell installed on it (Which I do have installed on my Raspberry Pi 🙂 )

Exit mobile version