Behind the PowerShell Pipeline logo

Behind the PowerShell Pipeline

Subscribe
Archives
May 7, 2024

PSReadLine Profile Power

The PSReadLine module is one of the most useful tools we have in PowerShell. You utilize it every day without realizing it. An early version of the module shipped with Windows PowerShell. The latest version is included with PowerShell 7. To get the most from the module, you should make sure you have the most current version.

PS C:\> Find-Module PSReadLine

Version              Name               Repository      Description

-------              ----               ---------       -----------

2.3.5                PSReadLine         PSGallery       Great command line editi...
You can try to run `Update-Module PSReadline` to install the most current version. However, if you have never updated the module, you still have the version that shipped with Windows. Most likely version `2.0.0`. If so, you'll get an error.
Update-Module : Module 'PSReadline' was not installed by using Install-Module, so it cannot be updated.
If you get this error, you need to *install* the module
 Install-Module PSReadline -Force
You either need to restart PowerShell, or manually reload the module.
PS C:\> Remove-Module PSReadline

PS C:\> Import-Module PSReadline
Don't worry about the 2.0.0 version. You can't uninstall it. PowerShell will always load the most current version of the module. From this point forward, you can use `Update-Module` to keep it updated. Don't forget to update help after installing a new version.
Update-Help PSReadline -force
The module works in Windows PowerShell and PowerShell 7, including cross-platform. > *If you encounter an error trying to update the module help, you might need to fix a casing-bug. The PSReadLine module originally, used a lower-case L. If you've never upgraded that's probably what you have. However, the module now uses an upper-case L. The module update is case-insensitive. But help is not. Once you update the module, rename the module folder to `PSReadLine` with a capital "L", then try updating help.* Now, we can look at how to get the most from this module.
Get a premium subscription for full article and archive access

The PSReadLine module is one of the most useful tools we have in PowerShell. You utilize it every day without realizing it. An early version of the module shipped with Windows PowerShell. The latest version is included with PowerShell 7. To get the most from the module, you should make sure you have the most current version.

PS C:\> Find-Module PSReadLine

Version              Name               Repository      Description
-------              ----               ---------       -----------
2.3.5                PSReadLine         PSGallery       Great command line editi...

You can try to run Update-Module PSReadline to install the most current version. However, if you have never updated the module, you still have the version that shipped with Windows. Most likely version 2.0.0. If so, you'll get an error.

Want to read the full issue?
GitHub Bluesky LinkedIn About Jeff
Powered by Buttondown, the easiest way to start and grow your newsletter.