I’m running a Windows 10 1809 at home and encountered something weird about PSReadline.
You know PSReadline is the module from Jason Shirk that enables great command line editing in the PowerShell console host.
It maintains an history of commands accross consoles and the ability to search the history (it works using CTRL+R, the same way a Bash shell works), and much more!
As you can see below in the picture. I’m running a En-US input language with a french keybord layout.
The module version 2.0 that shipped in Windows is loaded but the history isn’t maintained. That’s why I cannot search the history and invoke the following method although the class exists:
NB: This method only exist in version 2.0. It does not exist in version 1.2 that shipped in Windows 10 1803.
It throws the following error:
“The type initializer for ‘Microsoft.PowerShell.PSConsoleReadLine’ threw an exception.”
Because Jason wrote the following https://github.com/lzybkr/PSReadLine/pull/831 , I went this route:
If you’d rather not use PsGet, you can just download the file PSReadLine.zip and extract the contents into your C:\Users\[User]\Documents\WindowsPowerShell\modules\PSReadLine folder. (You may have to create these directories if they don’t exist.)
I also needed to modify the Execution policy:
Note that if you’ve an Application Control solution, nothing is signed digitally:
The above solution works in a admin console, the command history is maintained and is searchable 🙂
But it still doesn’t work with a filtered admin token in a non-admin console 😦