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> 
2
  • LOL, is this real? :D
    – Ryan Ries
    Nov 12, 2013 at 0:54
  • 4
    I may not have slept last night, consequently I am now dreaming of a better world.
    – MikeyB
    Nov 12, 2013 at 0:56

1 Answer 1

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!

10
  • 1
    Sweet! Nice to know how to do it. Here's what it looks like: gist.github.com/Supermathie/7423949
    – MikeyB
    Nov 12, 2013 at 1:44
  • Awesome. I've never seen EMS used in a production environment. Only by kernel debuggers and device driver writers have I ever seen it used. But more power to you! I'd upvote this question twice if I could. :)
    – Ryan Ries
    Nov 12, 2013 at 1:48
  • I'm a bit gobsmacked that there's no "just a serial console" option in EMS. That would be useful.
    – MikeyB
    Nov 12, 2013 at 15:06
  • Well, Windows doesn't really have a command line in normal operations. It doesn't have runlevels like Unix. It is GUI to the core.
    – mfinni
    Nov 12, 2013 at 20:28
  • 3
    @mfinni Not entirely true in today's module-based Windows. Look at Server Core or Hyper-V Server (the standalone free hypervisor). Windows is pretty lean and slowly pulling away from GUI dependence thanks to PS.
    – Ashley
    Nov 12, 2013 at 21:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .