33

How do I enable a serial console on Windows (2008 and/or 2012) such that I can log into it like the Good Old Days of Real Servers and issue provisioning commands, ideally via PowerShell?

$ cu -l /dev/ttyS0
Connected.

Welcome to ad1.adlab.brazzers.com

Microsoft Windows [Version 6.1.7601]
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

Login: Administrator
Password: 

PS C:\Users\Administrator> New-NetIPAddress –InterfaceAlias eth0 –IPv4Address 192.168.101.11 –PrefixLength 24 -DefaultGateway 192.168.101.1

PS C:\Users\Administrator> 
MikeyB
  • 40,079

1 Answers1

40

Wow, well, what you want is called Emergency Management Services (EMS) redirection.

http://msdn.microsoft.com/en-us/library/ff542282(v=vs.85).aspx

And it works on modern versions of Windows.

In XP/2003, enabling it would look like

bootcfg /ems on /port com1 /baud 9600 /id 1

On Windows Vista/2008+ it is enabled by typing the following command where {default} is the OS entry in BCDedit:

BCDedit /bootems {default} ON

The following commands set the global EMS redirection settings to use COM2 and a baud rate of 115200, and enable EMS for the specified boot entry.

bcdedit /emssettings EMSPORT:2 EMSBAUDRATE:115200

Something that not many people know is that you can still connect to a Windows computer using EMS and perform a few administrative functions even after the computer has experienced a STOP/bugcheck/BSoD!

Powershell? I don't know about that... I kinda' doubt it, but who knows. The envisioned usage for EMS is after everything else has failed, but you can get a cmd.exe shell with EMS... and you can type powershell.exe from a Cmd.exe shell... so maybe.

That's the best Microsoft-native thing you're gonna get. Otherwise you are looking at third-party software for running a server over a COM or USB port.

The book Windows Server 2008 R2 Secrets By Orin Thomas has a decent section on EMS, which is actually freely Googlable.

Edit: Verified, Powershell is possible through EMS!

PS: You're nuts!

Ryan Ries
  • 56,311