Installed PowerShell 7 on one of my Hybrid Runbook Workers today thinking I should start testing my Runbooks against PowerShell 7 and slowly move over to that. I was already in the spirit of upgrading things as I had been modifying my Runbooks to work with new Graph v2 module so why not.
That turned out to be a time suck. Once I installed PowerShell whenever I type something like “abc” into the console it would appear as “a@b@c@”. So irritating. Copy pasting works fine, and I spent a lot of time looking at the locale etc. but to no avail. PowerShell 5 was fine, but if I launch PowerShell 7 via pwsh.exe
from PowerShell 5 it’s console too misbehaves.
I downgraded the version. All the way to 7.1.7 where everything I type is just shown as “@@@”. Googling didn’t help, Twitter didn’t have anything… GitHub issues too wasn’t very helpful. What does one even search for a problem like this?
Finally I hit upon this issue. Upgrading PSReadLine did the trick for that person, but it didn’t for me. Aaargh. Finally I uninstalled PSReadLine (Remove-Module PSReadLine
) and now it works!
What a time suck.
Never had this issue anywhere else. This was a Server 2019 whereas usually I use PowerShell 7 on my macOS or Windows 11.
I then tried to uninstall PSReadLine but that errored:
1 2 3 4 5 |
> Uninstall-Module PSReadLine WARNING: The version '2.3.1-beta1' of module 'PSReadLine' is currently in use. Retry the operation after closing the app lications. Uninstall-Package: Module 'PSReadLine' is in currently in use or you don't have the required permissions. |
Not a problem, I tried working around it by typing the following in a command prompt window:
1 |
pwsh -noprofile -command "Uninstall-Module PSReadLine" |
That worked, but PowerShell 7 still showed the @ characters on a fresh launch.
I don’t think it really uninstalled coz I could still see it under C:\Program Files\PowerShell\7\Modules\PSReadLine
.
I suppose I should just delete it, but I just modified the profile (notepad $PROFILE
) and added a line (Remove-Module PSReadLine
) to disable it.
Update: For my own ease of use next time. Copy paste this on a new PowerShell 7 install that behaves weird:
1 2 3 |
Remove-Module PSReadLine if (!(Test-Path $PROFILE)) { New-Item $PROFILE -Force } 'Remove-Module PSReadLine' | Out-File $PROFILE |