Peter Hinchley

Learning in Public

✪ Install Windows Server 2012 R2 on a Mac Mini

The Mac Mini can be used as a small, sleek and silent virtualisation host. I use a late 2012 edition for running Windows Server 2012 R2 with the Hyper-V role enabled. The system has the following specifications:

This article will take you through the process I used to install Windows Server 2012 R2 onto a Mac Mini. This is what you will need:

I have written the following PowerShell script to simplify the preparation of the USB stick. The script creates a UEFI bootable USB stick suitable for installing Windows Server 2012 R2. The script should be run from an elevated PowerShell prompt on an x64 version of Windows 7 or later.

# Path to the Windows Server 2012 R2 ISO.
$iso = "C:\Temp\en_windows_server_2012_r2_with_update_x64.iso"

# Path to the NetXtreme Broadcom Driver.
$nic = "C:\Temp\nic"

# Drive letter of USB media.
$usb = "X:"

# Disk number of USB media.
$num = (Get-Disk)[-1].Number

# Format USB media.
Get-Disk $num | Clear-Disk -RemoveData -Confirm:$false
New-Partition -DiskNumber $num -UseMaximumSize -IsActive -DriveLetter $usb[0] | Format-Volume -FileSystem FAT32 -NewFileSystemLabel USB -AllocationUnitSize 16KB -Confirm:$false

# Mount the Windows Server 2012 R2 ISO.
$mount = Mount-DiskImage -ImagePath $iso -PassThru
$drive = ($mount | Get-Volume).DriveLetter + ":"

# Copy the files from the mounted ISO to the USB media.
Get-ChildItem $drive\ -Recurse | ? name -notmatch install.wim | 
  Copy-Item -Destination {Join-Path $usb $_.FullName.Substring($drive.length)}

# Split WIM if necessary.
if ((Get-Item $drive\sources\install.wim).Length -gt 4GB) {
  & dism.exe /Split-Image /ImageFile:$drive\sources\install.wim /SWMFile:$usb\sources\install.swm /FileSize:3500 | Out-Null
} else {
   Copy-Item $drive\sources\install.wim $usb\sources\install.wim
}

# Apply the master boot code to the USB media.
& $drive\BOOT\BOOTSECT.EXE /NT60 $usb | Out-Null

# Prepare EFI on the USB media.
Copy-Item C:\Windows\Boot\EFI\bootmgfw.efi $usb\efi\boot\bootx64.efi -Force
Copy-Item $usb\efi\microsoft\boot\* $usb\efi\boot

# Copy the NetXtreme Broadcom Driver to the USB media.
Copy-Item $nic\* $usb

# Unmount the Windows Server 2012 R2 ISO.
Dismount-DiskImage -ImagePath $iso

Prior to running the script:

The script may take up to 5 or 10 minutes to complete.

A couple of points:

When the script completes, eject the USB stick, connect it to your Mac Mini. Now follow these steps to install Windows Server 2012 R2. Note: I have elected to install Windows in Server Core mode with Australian regional settings.

Assuming you have an ethernet cable connected to the Mac Mini, and the cable provides direct access to the internet, perform the following steps to set a static IP address, and to download and install software updates. Note: I have set the IP address to 10.0.0.10/24. You should use whatever address is appropriate for your environment.

That's it. You have successfully installed Windows Server 2012 R2 on a Mac Mini, configured the network stack, enabled remote desktop connections, and deployed all available software updates.