Skip to content

Instantly share code, notes, and snippets.

@marsell
Created August 3, 2018 15:21
Show Gist options
  • Save marsell/cd55815242f99955a8b4537d7e76f4eb to your computer and use it in GitHub Desktop.
Save marsell/cd55815242f99955a8b4537d7e76f4eb to your computer and use it in GitHub Desktop.
Basic Windows 2012r2 image creation with EMS' SAC on SmartOS
1.
Get Windows 2012r2 eval ISO from here: https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2012
Get virtio driver ISO from here: https://download.joyent.com/pub/vmtools/me-ws2012std-20130712.iso
For convenience, rename the ridiculously long Windows ISO to "win2012r2eval.iso"
2.
Example kvm.json is:
{
"brand": "kvm",
"vcpus": 2,
"autoboot": false,
"ram": 2048,
"disks": [
{
"boot": true,
"model": "virtio",
"size": 10240
}
]
}
3.
vmadm create -f kvm.json
export UUID=<uuid>
cp me-ws2012std-20130712.iso win2012r2eval.iso /zones/$UUID/root
vmadm start $UUID order=cd,once=d cdrom=/win2012r2eval.iso,ide cdrom=/me-ws2012std-20130712.iso,ide
vmadm update $UUID vnc_port=5900 vnc_password=foo
4.
Connect using VNC client to GZ IP + vnc port above. If you're using a Mac,
command-K in a Finder window will give you a VNC client; enter
"vnc://<GZ IP>:5900". The password is "foo".
5.
* On Windows installer localization screen, click "Next".
* Click "Install Now".
* On the OS selection screen, pick either of the "Datacenter Evaluation"
versions. I prefer the "Server Core" of the two, since the final image is
smaller, and it forces you to do everything on the command-line.
* Check "I accept the license terms" and click "Next"
* Select "Custom: Install Windows Only" and click "Next"
* Click "Load driver", click "browse". You should get a navigation
GUI. Navigate to E:\drivers\viostor\Win 7\amd64, click "OK". Click "Next".
* For the installation location, it should list "Drive 0 unallocated space".
Click "Next".
* ...wait for the install and a reboot (or two)...
* Click "OK" to change the password, enter a new password twice. Click "OK" on
change.
* You should now have a console window running in Windows. To enable SAC
console for subsequent boots:
bcdedit /ems {default} on
bcdedit /emssettings emsport:1 emsbaudrate:115200
* This won't work with the example kvm.json (no NIC), but for reference:
To install the networking virtio drivers run:
pnputil -i -a e:\drivers\NetKVM\Vista\amd64\netkvm.inf
Click "Install".
Then do your network commands (like "ipconfig", "route" and "netsh").
* shutdown /s
6.
rm /zones/$UUID/root/*.iso
imgadm create $UUID name=windowseval version=1.0.0 type=zvol os=windows
You now have a bootable Windows image with SAC installed. To use SAC on a
running Windows instance, vmadm console $UUID, type "cmd", then "ch -si 1".
It'll ask you login details (i.e. username "Administrator" and the password
you entered earlier), then dump you to the same Windows console you saw
through VNC.
To use the image, first install it:
imgadm install -m windowseval-1.0.0.imgmanifest -f windowseval-1.0.0.zvol
And create a new VM with:
{
"brand": "kvm",
"vcpus": 2,
"autoboot": false,
"ram": 2048,
"disks": [
{
"boot": true,
"model": "virtio",
"image_uuid": "<image uuid>"
"image_size": 10240
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment