This free framework gives you the tools to build a lab. The premium course teaches you how to master it.
If you want a complete, step-by-step learning experience that goes beyond the basics, enroll in the full course to learn how to:
- Master the Lab Workflow: Go beyond setup and learn to use Snapshots to instantly save and restore your lab state.
- Build a Full Active Directory Domain: Automatically deploy a DC and create a realistic enterprise lab.
- Add additional disks to your VMs using automation: Add additional disks to your SQL Server VMs using automation.
I built this framework to quickly spin up sandbox environments without needing to install Windows each time manually. It's also used by students in my courses hosted at https://www.automatesql.com, focusing on SQL Server builds using Ansible.
The Automated Sandbox Framework provides all the resources you need—HashiCorp Packer HCL templates, PowerShell scripts, autounattend files, and Vagrantfiles—to build fully automated virtual sandbox environments.
By default, it creates a Windows Server 2025 Standard Evaluation image with SSH enabled. On the first boot, each VM is sysprepped to ensure a unique SID is generated.
The included Vagrantfile can create 5 virtual machines. Consider setting up a domain controller (DC1) for a more realistic scenario. Additional secondary disks can be added manually using the VMware Workstation Pro GUI or by configuring the vagrant file to use the Vagrant Disk. However, it's not currently included.
Example Machine Roles:
- DC1: Domain Controller
- SRV1: Jumpbox/Tools Host
- SQL1: SQL Server Developer
- SQL2: SQL Server Developer
- SQL3: SQL Server Developer
-
Host OS: Windows 11
- Disable Hyper-V.
- Ensure nested virtualization is supported.
See this link for details.
-
Hardware:
- CPU: x64 with virtualization support .
- Memory: 16 GB minimum (more may be needed to support larger environments).
- Storage: At least 128 GB free.
-
Precheck:
- Run the precheck-virtualizationsupport.ps1 script as an Administrator. This script will check your system for potential issues with the lab setup.
-
VMware Workstation Pro 17 (How to install using Chocolatey) (Currently this method is broken. Follow these steps instead -
-
Select VMware Workstation Pro (version) for Windows and proceed to download and install the software.
The win2025.pkr.hcl template leverages Packer to:
- Install and update Windows Server 2025 automatically.
- Install VMware Tools.
- Enable SSH access.
- Package everything into a Vagrant
.boxfile, eliminating manual setup.
Key Points:
- Requires
vmwareandvagrantPacker plugins. - Uses variables for customization (
iso_checksum,memsize,numvcpus, etc.). - Employs the
vmware-isobuilder and multiple provisioners (PowerShell scripts, file uploads, restarts). - A final post-processor creates the
.boxfile.
-
Password:
Update the default password ("packer") at:scripts/autounattend.xml: Lines 144, 177scripts/unattend.xml: Lines 64, 98
-
Time Zone:
Editunattend.xmlto set your preferred time zone (the default is Central Standard Time). -
Windows Server Edition:
By default, the template uses Standard Evaluation (Index 2). ModifyAutounattend.xmlif you need a different edition:- Index 1: Windows Server 2025 Standard Evaluation
- Index 2: Windows Server 2025 Standard Evaluation (Desktop Experience)
- Index 3: Windows Server 2025 Datacenter Evaluation
- Index 4: Windows Server 2025 Datacenter Evaluation (Desktop Experience)
- Update
iso_checksum. To get the iso checksum, useGet-FileHash pathToISOin PowerShell. - Adjust other variables as needed.
Before building, run packer init to fetch the required plugins:
cd path\to\win2025.pkr.hcl
packer init win2025.pkr.hclStart VMware Workstation Pro prior to running packer build.
cd path\to\win2025.pkr.hcl
packer build --var-file="variables.pkrvars.hcl" win2025.pkr.hclThis step will take several minutes to complete. You'll see the image being built in VMware Workstation Pro.
The example vagrantfile will create 5 VMs. Modify the machines array as needed:
machines = [
{ name: "DC1", memory: 4096, cpus: 4, vnet: "VMnet8", nat_device: "vmnet8"},
{ name: "SRV1", memory: 8192, cpus: 4, vnet: "VMnet8", nat_device: "vmnet8" },
{ name: "SQL1", memory: 8192, cpus: 8, vnet: "VMnet8", nat_device: "vmnet8" },
{ name: "SQL2", memory: 8192, cpus: 8, vnet: "VMnet8", nat_device: "vmnet8" },
{ name: "SQL3", memory: 8192, cpus: 8, vnet: "VMnet8", nat_device: "vmnet8" }
]- Set config.vm.box to the path of your new .box file.
- Set config.ssh.password to the password used during image creation.
Open either a command window and navigate to the directory where the vagrantfile resides.
- Run
vagrant up.
VMware Workstation will create the VMs. Expect a few reboots on the initial run. Subsequent startups will be much faster.
-
To shut down all VMs, run
vagrant halt. -
To completely destroy all VMs created by this vagrantfile run
vagrant destroy.
For more vagrant commands see this link
This framework dramatically reduces manual setup time, making it easy to spin up multiple, fully configured Windows Server environments for testing, development, or lab scenarios.