Background:
One of the geeks wanted help using the Networking and iSCSI Configuration starter scripts from our blog post earlier in the year; Starter Scripts for ESXi Hosts.
A few days after getting the script tuned for their needs, they mentioned not having any hosts available to test the script, and they were caught off guard when I asked why they weren’t using a few nested ESXi hosts to test the script prior to their new hosts being available.
Reasons to use nested hosts, for testing scripts only:
- Nested hosts restart faster than physical hosts.
- Snapshot their working state and revert back to that state after testing your script(s).
- Access DCUI of the host through console in vCenter.
- You may make changes to the management network of the host and would lose access without an out-of-band solution.
This post will focus on taking a snapshot of the nested hosts’ working state and reverting to that state after testing your script(s).
The PowerCLI script, “revert_test_vms.ps1” referenced in this post, is available on our public GitHub repo: https://github.com/humbledgeeks/amount
Script Information: “revert_test_vms.ps1”
- Stop the nested hosts.
- Revert to the preferred snapshot.
- Start the nested hosts.
Assumptions:
- Create two, or three, nested ESXi hosts.
- We gave each nested host:
- vCPU = 2
- vRAM = 6GB
- vHDD = 80GB
- vNIC = 2, you can add more NICs to match the physical hosts in your environment.
- We gave each nested host:
- Place those hosts in a folder named “test-scripts”.
- If you prefer a different name, you will need to change the ‘-Location’ value in the PowerCLI script to match that folder name.
- Configure the management network on each host to make them accessible after reverting to their snapshot.
- Shut down the nested hosts after the management network configuration is completed.
- Download the “revert_test_vms.ps1” script or copy its contents into PowerShell.
Walkthrough: Taking a snapshot of the nested hosts.





– We used “2023-06-23T2015”



Test your script(s) on the nested hosts!
Walkthrough: Revert your nested hosts to their working state.


– Enter your credentials and click “OK”.

– You will see prompts that each nested host is being stopped, reverted, and started.