{"id":7152,"date":"2023-07-13T14:51:29","date_gmt":"2023-07-13T13:51:29","guid":{"rendered":"https:\/\/rakhesh.com\/?p=7152"},"modified":"2023-07-14T15:27:47","modified_gmt":"2023-07-14T14:27:47","slug":"powershell-7-adding-character-after-everything","status":"publish","type":"post","link":"https:\/\/rakhesh.com\/powershell\/powershell-7-adding-character-after-everything\/","title":{"rendered":"PowerShell 7 adding @ character after everything"},"content":{"rendered":"

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<\/a> so why not.<\/p>\n

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<\/code> from PowerShell 5 it’s console too misbehaves.<\/p>\n

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?<\/p>\n

Finally I hit upon this issue<\/a>. Upgrading PSReadLine did the trick for that person, but it didn’t for me. Aaargh. Finally I uninstalled PSReadLine (Remove-Module PSReadLine<\/code>) and now it works!<\/p>\n

What a time suck.<\/p>\n

Never had this issue anywhere else. This was a Server 2019 whereas usually I use PowerShell 7 on my macOS or Windows 11.<\/p>\n

I then tried to uninstall PSReadLine but that errored:<\/p>\n

> Uninstall-Module PSReadLine\r\n\r\nWARNING: The version '2.3.1-beta1' of module 'PSReadLine' is currently in use. Retry the operation after closing the app\r\nlications.\r\nUninstall-Package: Module 'PSReadLine' is in currently in use or you don't have the required permissions.<\/pre>\n

Not a problem, I tried working around it by typing the following in a command prompt window:<\/p>\n

pwsh -noprofile -command \"Uninstall-Module PSReadLine\"<\/pre>\n

That worked, but PowerShell 7 still showed the @ characters on a fresh launch.<\/p>\n

I don’t think it really uninstalled coz I could still see it under C:\\Program Files\\PowerShell\\7\\Modules\\PSReadLine<\/code>.<\/p>\n

I suppose I should just delete it, but I just modified the profile (notepad $PROFILE<\/code>) and added a line (Remove-Module PSReadLine<\/code>) to disable it.<\/p>\n

Update<\/strong>: For my own ease of use next time. Copy paste this on a new PowerShell 7 install that behaves weird:<\/p>\n

Remove-Module PSReadLine\r\nif (!(Test-Path $PROFILE)) { New-Item $PROFILE -Force } \r\n'Remove-Module PSReadLine' | Out-File $PROFILE\r\n<\/pre>\n

 <\/p>\n","protected":false},"excerpt":{"rendered":"

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 … Continue reading PowerShell 7 adding @ character after everything<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[2],"tags":[],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts\/7152"}],"collection":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/comments?post=7152"}],"version-history":[{"count":5,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts\/7152\/revisions"}],"predecessor-version":[{"id":7161,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts\/7152\/revisions\/7161"}],"wp:attachment":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/media?parent=7152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/categories?post=7152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/tags?post=7152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}