(This is a guest post by Antoni Sawicki aka Tenox)
While everybody is busy buzzing about Windows 11, I wanted to commemorate the finest operating system ever made by Microsoft – Nano Server.
The OS was somewhat esoteric and had a rather steep entry point, requiring you to build it on a Windows Server 2016 host using PowerShell magic spells. You couldn’t just download and run it. Even once you built and ran it, there wasn’t much you could “normally” do with it. Which made it much less popular than it deserved to be. My goal is to demystify this a bit, lower the entry bar and made it super easy for people to hack it.
Background and Intro (you can skip it)
This article started around my efforts to run (or port if needed) aclock to this platform. At the time of writing this article, the technology is already dead for several years, however all the artifacts and documentation are still available on Microsoft’s website. Probably not for long. So a good moment in time before everything gets deleted from existence.
Nano Server was an interesting attempt at creating a datacenter grade OS that’s not managed via local GUI, keyboard and mouse, but rather full automation, code and remote tooling. It went one step further than Server Core or Windows PE by completely removing GUI components and local shell. Hence it’s not actually called “Windows” or “Windows Nano” but rather simply “Nano Server”. Rumor has it, it started as MinWin. The OS has a rudimentary text mode console loosely resembling this of VMware ESXi. However Nano was much more than a bare metal hypervisor. It was a fully fledged operating system.
Ever since I first saw a demo on Microsoft Ignite (previously known as TechEd) I wanted to run aclock on the text console. Much like the WinNT BSOD edition. Unfortunately never really got to it until now.
How to quickly deploy Nano Server and run command line apps on the console
The hard way: you need to download Windows 2016 Server (eval) and run a PowerShell command to produce a bootable VHD file. While installing, you may want the Desktop Experience. However Nano creation is basically just a PowerShell command so you don’t actually need it.
Microsoft provides (soon to be deleted) Nano Server Quick Start. However the steps are trivial so you can totally skip that and stick just to this:
- Launch PowerShell terminal window on WS2016 host.
Import-Module D:\NanoServer\NanoServerImageGenerator -Verbose
(D:\ drive being where Windows Server CDROM is mounted)
New-NanoServerImage -DeploymentType Guest -Edition Standard -MediaPath d:\ -BasePath c:\nano -TargetPath c:\nano.vhdx -ComputerName nano -Development
(c:\nano folder and c:\nano.vhdx image will be created for you)
Done! This will build a .vhdx image that can be run under Hyper-V as Gen-2 VM. For Gen-1 or to run it on say Virtual Box change .vhdx to .vhd in -TargetPath while running the PowerShell command.
The easy way: you can just download a pre-built VM image from here.
Once you boot it up you will be greeted with a PowerShell prompt. Just like that! You can simply type
cmd to launch the good old cmd.exe shell. MS-DOS anyone?
Keep in mind, this is a developer mode, normally you would be greeted with login/password prompt and a boring menu that allows to change some networking settings and not much beyond that. In production mode you need to resort to hacks (or this) to get stuff running, fortunately nothing like that needed here.
So what can you run on it?
Firstly In order to get some external utilities going, you can mount a SMB share using
net use in cmd or
New-SMBMapping in PS world. Or being a server and all, better yet share out a folder via
net share or use
C$. Alternatively you can just shut it down, mount the vhd image on your host and copy stuff in to the image then detach the VHD. Finally, if you live in completely Windows-free world, you can install Posh-SSH module and use SCP from PowerShell.
Aclock worked on the first run, no issues, using standard win64 exe:
Wow! So looks like Nano console does have basic terminal controls. That opens quite a lot of possibilities. But can you run more complex apps? Text editors? Web browsers? GAMES?
Well, yes…, but likely not, but it really depends – on dependencies (read: DLLs).
Everything else has a variety of issues:
- The console is not a real text mode as was promised in MinWin or even was in NT BSOD. Rather it’s a weird graphical mode that merely emulates text.
- The font is lacking line drawing characters. Some editors like YEdit allow to use ASCII drawing characters fortunately.
- There is no reverse video. This manifests mostly in menus, etc. however it also applies to the cursor.
- There is no cursor, or rather the cursor is an underscore and not transparent cell. Moving arrow left in the CLI doesn’t actually move the cursor it erases characters. There is no line editing.
- Also related to reverse video, it appears Nano console is simply lacking a lot of colors.
- Missing DLLs. Nano Server not being a Windows OS is missing a lot of Windows DLLs and it has its own nano DLL hell. This has actually been acknowledged in MinWin. As such a lot of apps will not launch due to dependencies.
For example YEdit works remarkably well except for the menus, which use reverse video:
Perhaps Malcolm could make a Nano edition of YEdit? 🙂
So what about games?
Well I had a lot of hopes for ascii-patrol since it’s pure console and 64bit exe. Unfortunately didn’t work out because it was missing a bunch of multimedia/sound related DLLs from Windows. I think these can be either added, substituted or the game built without sound, but I did not had time for this. Maybe some readers do.
There was one game that actually worked! Its a pure PowerShell adaptation of snake:
I’m hoping readers can find more text mode/ascii apps and games that will work on the console. Please comment and send links!
In another dimension, having a semi working text editor, smb/scp, maybe with help of mingw64 or sdk tools one could have a self hosted developer workstation with this.
For now please just download the pre-build image, or make one yourself and run it in your favorite hypervisor. It’s fun!
With this, goodbye Nano Server! You will be always remembered. I know folks at Redmond tried really hard to make it such beautiful gem.
Minor note from Neozeed, I took the ascii patrol source, amputated all the neat multimedia stuff, borrowed the Unix clock code and gettimeofday, and had to use Visual Studio 2010 x64 to build this. There is no Win32, only Win64, and 2019 is just too new. I guess you could deploy the runtimes?
Also create local users to share stuff with powershell like this:
New-LocalUser "neozeed" -Password (ConvertTo-SecureString -AsPlainText "TooCoolForSchool" -Force) -FullName "Neo-Zeed" -Description "Super cool guy"
Something like this to create a local user and share out the disk to copy stuff. I’ll add more stuff later.