-
Deployment Automation of Windows Server 2016 labs on WS2016/Windows10 Hyper-V
-
Simply deploy your lab just with these scripts and ISO file.
-
Major differentiator is that once hydrated (first 2 scripts), deploy takes ~5 minutes. Cleanup is ~10s.
-
Options for setting up a Windows Server 2016-based lab are simpler than with some of the other available lab automation systems as the project is based on well-crafted Powershell scripts and, rather than XML or DSC configuration files.
-
Scripts are not intentionally doing everything. You can spend nice time studying scenarios.
-
This solution is used in Microsoft Premier Workshop for Software Defined Storage, Hyper-V and System Center VMM. If you have Premier Contract, contact your TAM and our trainers can deliver this workshop for you.
-
Check this page for end to end scenarios! It's just a small portion I wrote for internally for consultants and PFEs in Microsoft
-
Want to try Windows Server insider builds? Check this page
-
Want to try Windows Server 1709? Check this page
Videos are bit outdated as subtle changes are in scripts.
- 1 Lab Hydration
- 2 Lab Deployment
- 3 S2D Scenario
- 4 Bonus-S2D to S2D Storage Replica Scenario
- 5 Windows Server Insider and Honolulu
- Scripts
- Windows Server 2016
- Latest Cumulative Update for Windows Server 2016 and Servicing Stack Update
- Edit it to specify the lab setup that you require (such as different domain name, Domain Admin name...) This script file documents the detailed configuration options that are available. (The default script will generate a lab with a Windows Server 2016 DataCenter Domain Controller and 4 Windows Server 2016 Core servers ready to be set up with Storage Spaces Direct.)
Default Labconfig
Default Labconfig with collapsed sections (ctrl+M)
Advanced LabConfig (deleted lines 1-11)
- 1_Prereq.ps1 will create folder structure and downloads some additional necessary files from internet
- If you don't have an internet connection on your server, run this on internet connected machine, copy created files over and run 1_prereq.ps1 again
Result
Result: Tools folder created
CreateParentDisk tool, DSC modules and ToolsVHD folder
-
If you modified labconfig.ps1 in Step 3 to also deploy SCVMM, populate the
Tools\SCVMM
folder. If you downloaded SCVMM trial, run the exe file to extract it. Also extract SCVMM Update Rollups (extract MSP files from cabs) -
You can also copy your favorite tools you would like to have in ToolsVHD, thats always mounted to DC, or optionally to any machine in lab.
SCVMM Folders in ToolsVHD folder
- 2_CreateParentDisks.ps1 will check if you have Hyper-V installed, it will prompt you for Windows Server 2016 ISO file, and it will ask for packages (provide Cumulative Update and Servicing Stack Update). After that it will hydrate parent disks and Domain Controller.
- Domain controller is provisioned using DSC. Takes some time, but after that you do not need to run this step anymore as DC is saved, used for deploy and then returned to previous state before deploy step.
ISO Prompt
MSU Prompt
Result: Script finished
Result: Script cleanup unneccessary folders - before
Result: Script cleanup unneccessary folders - after
Result: Parent disks are created
Result: DC, thats imported during deploy, is Created
- Deploy.ps1 will deploy servers as specified in Labconfig.ps1 By default, it will deploy servers for S2D Hyperconverged scenario
Result
Step 8 Continue with S2D Hyperconverged Scenario
- will guide you to deploy 4 Node Storage Spaces Direct cluster.
- Note: scenario is completely separate script. You use it when logged into DC. Take your time and look what it does as you can easily learn from it. If you are not in rush, run it line by line in PowerShell or PowerShell ISE and look with GUI what has changed to fully understand what's happening.
- VMs and switch is identified using prefix defined in LabConfig.
- All VMs\Switches with prefix are listed
Step 10 Try different scenarios
- Just replace LabConfig and Deploy again (takes 5-10 minutes to spin up new VMs)
- In tools folder is CreateParentDisk.ps1 script created. You can use this anytime to create additional parent disks (such as Server with GUI or Windows 10). Just right-click and run with PowerShell
- If you want to run scripts on Server Core, modify labconfig and use ServerISOFolder and ClientISOFolder variables (MSUs are optional)
- disable Defender during CreateParentDisks as AMSI is scanning scripts and it utilizes CPU. (Takes twice more time to create parent disks)
- every script is creating transcript file. You can look for issues there.
- if you want internet connection, just specify Internet=$true in Labconfig.
- DISM does not work on Cluster Shared Volumes
- When waiting on DC to come online, the script throws some red errors. It's by design, nothing to worry about.
- DISM sometimes throws errors on NTFS volumes also. Just build the lab again in different folder.
- sometimes if all machines are started at once, some are not domain joined. Just cleanup and deploy again.
Simulations such as
- how to script against servers
- how to automate configuration
- what will happen when I run this and that command
- how change drive in S2D cluster
- what will happen when one node goes down
- testing new features before pushing to production
- ...