| Using PowerShell through SSH |
|
|
| Written by Leon Ruumpol source: Md Log, Monday, 25 September 2006 | |
|
Matt Michie’s come from UNIX, where the text shell is the preferred way to do system administration. He writes a pretty cool howto about the powershell trough SSH. Windows has needed a powerful shell since before MS-DOS (not sure what the default shell in Xenix was). The PowerShell team seems to be laying out some of the architecture that will be needed to bring Microsoft forward on this front. I’ve argued before that one of the reasons Google is beating Microsoft is the easy scriptability and command line interface on Google’s Platform, Linux. If Microsoft wants to play seriously with admins like me and compete with Apple and Google, they will have to continue building on PowerShell. One of the key components of System Administration is remote access. It would be absurd to have to physically walk up to every machine you were responsible for and use the keyboard and mouse to configure or install anything. There are some pretty good tools for working with Windows remotely, but most of them require a video card and mouse. I can type upwards to 100 words a minute, anytime I have to move my hands off the home row to the mouse, I am losing productivity. Anytime I have to stream video, I am wasting bandwidth. I can administer a UNIX box from a palmtop device like a Sidekick over a slow cell phone connection. One of the first things that an admin wants to do with PowerShell is run remotely. To do this securely, you must encrypt your data. SSH has been the proven way to do this. So the question becomes, how do I connect SSH and PowerShell together? With a little bit of kludge, it is possible. Why this wasn’t included by default in version 1.0, I have no idea. My advice and plea to the Microsoft developers is to just use SSH. Please don’t invent a proprietary Microsoft only tool to do this. Please please please please! Note: The following assumes that you have logged in as a local admin and this account has a password. Download and Install CygwinFire up Firefox (or your favorite browser) and choose a Cygwin Mirror.
However, make sure to select SSH under the Network category. It will select the other required dependencies for you. Configure CygwinRight click My Computer, select Properties -> Advanced -> Environment Variables. Next, click the New button and add: name: CYGWIN value: ntsec Select the Path variable and click Edit then append ;c:\cygwin\bin (assuming you installed Cygwin here) at the end of the existing string. Download and Install Microsoft ToolsNote: The following requires Microsoft Passport aka Live ID Unzip the downloads and run their respective setup. I used all the defaults. Run Cygwin
Run PowershellStart -> Programs-> Windows Powershell. Choose to always accept Microsoft signed code. Close PowerShell Test SSH and PowershellRun Putty or your favorite ssh client and connect to localhost. Accept the hash and login. If everything works, you should be at a bash prompt in Cygwin. Next run PowerShell. Due to the limitations of PowerShell v1.0 we have to tell it that we are redirecting the input. Note that you won’t get any output from PowerShell indicating that it started up, including a command prompt!
Try a PowerShell one-liner:
LinksCreditsBig shout out and thanks to Lee Holmes for answering my e-mail and pointing me in the right direction, and PigTail Cygwin SSHD Instructions for clearing up some of the finer points in the SSH install.
Original article: http://hivearchive.com/2006/07/03/using-powershell-through-ssh/ |
| < Prev | Next > |
|---|

