Turn Off PSReadline

Beginning with Windows Management Framework 5 Microsoft decided to ship Pester and PSReadline baked into the framework. Pester is a testing framework and PSReadline is a handy utility that brings some bash functionality to the PowerShell console.

PSReadline brings syntax highlighting and amazing multi-line editing to the console and I don’t know if I could go without. Alas, not all modules are right for all people so we’re going to go and figure out how to remove PSReadline.

First, we need to dive into how modules get loaded. Normally, at the console, when you’d like to run a cmdlet from an unloaded module you simply run the command and powershell will dynamically load it (Note: That is as of v3. Version 1 and 2 required you to run Import-Module before running any cmdlets from the module).

You’ll notice however that PSReadline runs even before you run any cmdlets, let alone ones from the module. To get around this you’ll have to edit your PowerShell profile. The profile is a PS1 file that runs whenever you load the console or Integrated Scripting Environment.

You simply need to edit the file found at ~\Documents\WindowsPowerShell\profile.ps1 and add the following.

Remove-Module -Name PSReadline

To handle this all from the console simply run:

Add-Content -Value "`r`n Remove-Module PSReadline" -Path $PROFILE

Exit out of the console and reopen it. You’ll see that PSReadline is no longer running in your session.