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:
- 2.6GHz Quad-Core Intel Core i7
- 2 x 8GB 1600MHz DDR3 SDRAM
- 2 x 256GB Solid State Drive
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:
- Apple Mac Mini (late 2012 model)
- Windows Server 2012 R2 ISO (and product key)
- NetXtreme Broadcom Driver
- USB stick (8GB or larger)
- Computer running an x64 version of Windows 8.1/2012 R2 or later (for preparing the USB stick)
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:
- Modify the path to the Windows Server 2012 R2 ISO.
- Modify the path to the extracted NetXtreme Broadcom driver files.
- Connect a USB stick to the computer (it will be erased; you have been warned).
The script may take up to 5 or 10 minutes to complete.
A couple of points:
- The script creates a FAT32 volume on the USB stick. This is a requirement for UEFI.
- As the maximum file size on a FAT32 volume is 4GB, the script uses DISM to split install.wim into multiple files when necessary.
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.
- Power-on the system whilst holding down the Option key (or the ALT key on a Windows keyboard).
- Select the orange EFI Boot icon (the image is of a removable USB stick), and press Enter.
- When the Windows Setup dialog is displayed, press Shift+F10 to open a command prompt.
- Run the following commands to erase the (first) hard drive, and configure the disk with a GUID partition table (GPT):
diskpart select disk 0 clean convert gpt exit
- Type
exit
to close the command prompt. - At the Windows Setup dialog, set the Language to install to English (United States), the Time and currency format to English (Australia) and Keyboard or input method to US and click Next.
- At the next screen, select Install now.
- Enter a product key when prompted, and click Next.
- Select Windows Server 2012 R2 Standard (Server Core Installation) and click Next.
- Select I accept the license terms and click Next.
- When asked What type of installation do you want, select Custom: Install Windows only (advanced) and press Enter.
- Select Drive 0 Unallocated Space and click Next.
- Windows will install (and the Mac Mini will reboot multiple times).
- When prompted, set the Administrator password.
- You will now be logged in. From the command prompt, change to the USB drive (in my case it was D:) and then change into the nic folder.
- Run the following command to install the NetXtreme Broadcom driver:
pnputil -i -a b57nd60a.inf
- Open a PowerShell prompt and rename the computer (e.g. to name the computer GEORGE):
rename-computer GEORGE
- Restart the computer:
restart-computer
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.
- To set the IP address of the computer, open a PowerShell prompt and run:
New-NetIPAddress –InterfaceIndex (Get-NetAdapter).ifindex –IPAddress 10.0.0.11 –PrefixLength 24 –DefaultGateway 10.0.0.1
- To assign a DNS server address to the interface:
Set-DnsClientServerAddress –InterfaceIndex (Get-NetAdapter).ifindex –ServerAddresses 10.0.0.1
- To open the firewall to allow inbound Remote Desktop connections:
Enable-NetFirewallRule -DisplayGroup "Remote Desktop" -confirm:$false
- Type
exit
to return to the command prompt. - Enable Remote Desktop access with the following command:
cscript.exe C:\Windows\System32\SCregEdit.wsf /ar 0
- Enable the automatic download of Windows Updates (4 = automatic, 1 = manual):
cscript C:\Windows\System32\SCregEdit.wsf /AU 4 net stop wuauserv net start wuauserv
- Initiate the update process:
cscript.exe C:\Windows\System32\en-us\WUA_SearchDownloadInstall.vbs
- When prompted, enter A to search for all applicable updates. This may take several minutes to complete.
- When prompted, enter A to download and install all identified updates. Again, this may take several minutes to complete.
- When prompted to restart the computer, select Yes.
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.