Skip to content

New-FactoryVM.ps1

Source file scripts/factory/New-FactoryVM.ps1. This page is generated from the file’s own help comment when the site is built.

.SYNOPSIS Builds (or rebuilds) the code factory's Hyper-V VM: Windows installed from an ISO, unattended, ready for PowerShell Direct.
.DESCRIPTION Run elevated (Hyper-V needs it). Creates a Gen 2 VM on the Default Switch with an empty disk, the ISO in its DVD
drive and a small second disk holding autounattend.xml (local admin "factory", auto sign-in, remoting on). Windows
Setup does the partitioning and boot files inside the VM. Then it waits for the signed-in desktop, removes the
installer media and checkpoints the VM as "windows-ready". The VM's password is generated once and kept in
Then run Install-FactoryTools.ps1.
.EXAMPLE powershell -File scripts\factory\New-FactoryVM.ps1 -Iso a local path
  • -Iso
  • -Name
  • -Root
  • -DiskBytes
  • -MemoryBytes
  • -Cpus
  • -Force