4

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 🙂

 

Filed in: Articles, Online Only Tags: , , , , ,

4 Responses to "PowerShell Linux to Windows integration (encoding problem)"

  1. Scott Muc says:

    Very cool! I’m curious why you use PowerShell server (I’m not familiar with that product at all) over the Enter-PSSession cmdlet?

    • akaDimiG says:

      PowerShell server allow us to control Windows by non Windows systems (including mobile) on slow networks. PowerShell remote connection possible only from Windows platform.

  2. Luc Dekens says:

    Not going to start an OS war, but isn’t the “it’s still alive” a bit exaggerated ?
    Interesting article btw.

    • akaDimiG says:

      I’m not going to start OS war discussion too. 😉 Now we have three major system. It is fact. Or just a Windows and others. Or let’s make one major system, cause other makes our days difficult.
      Regarding Windows I’d like to see the system which could be made from scratch. The architecture is too outdated, and would be great if Microsoft will take any discontinued system as base and make it own as Apple did. Thanks for comment BTW.

Leave a Reply

Submit Comment

© 2016 PowerShell Magazine. All rights reserved. XHTML / CSS Valid.
Proudly designed by Theme Junkie.
%d bloggers like this: