PowerShell Linux to Windows integration (encoding problem)
In my life I try to be on the edge of IT technology and if I find something interesting I try to be in touch with it. I’m a big fan of UNIX based systems and impressed by their reliability and flexibility. That is why I love Linux and Mac OS.
I realize that Windows is the third major system, it’s still alive and used in most of companies around the world. Windows 7 looks better protected and much more reliable. So, I studied it and looked the new technologies it offered. The weak points in Windows were the reliability, security, virus protection and command line interface. I’m a big enthusiast of CLI (command line interface) on Linux systems and this article is dedicated to that.
The first time I heard about Windows PowerShell I said “Wow, that is crazy”. What a great idea, make the command line shell in Windows really powerful. I won’t compare it to UNIX bash here. It is clear that PowerShell gives system administrators the ability to automate their job and a way to control the Windows systems through slow network connections. That is great.
In addition to my CLI interests, I’m a big enthusiast of OS integration. I’ll explain what I mean. Usually in companies I’ve been at, there are offices with Windows 7 desktop computers and laptops. Some have Windows Servers or Linux. The companies who do design, advertisement, computer graphics, post-production or TV have all three systems in their network. That means: Mac OS, Linux, Windows 7 and even Windows XP. Control and integration is a problem. I’m looking for technology which can help. PowerShell and SSH may make this happen.
Until now, Windows 7 didn’t have SSH out of the box. It uses an outdated `telnet’ for console connections. Thanks to @ShayLevy for the tip on the PowerShell SSH Server from /n Software. It looks great for these types of integration. Plus, they have a free version with a one connection limit.
The problem I faced – we have a Russian version of Windows 7. That means if I try to connect it with SSH from Linux I get a question mark in PowerShell replies.
The problem is different locales. The Linux box has modern UTF-8, the Windows have their own WIN-1251 for the Russian language. So, PowerShell Server from /n Software translates the reply incorrectly encoded.
I solved this by tweaking the registry for PowerShell Server.
First, I need to make a new string parameter in `HKEY_LOCAL_MACHINE ➜ SOFTWARE ➜ PowerShellInside ➜ PowerShellServer’. The `WireEncoding’ should be set to `UTF-8′.
Then I run PowerShell server as a Windows Service, restart it, and connect through SSH again. It now works with the correct Russian responses.
Happy Holidays 🙂Share on: