Unattended Install of Windows using Powershell and Hyper-V

automated-installpowershell-v3.0

Is this possible? I have a script that gets up to the point of Installing Windows Server 2008. However it gets up literally to the "Click Next……etc etc…" and I want to be able to integrate this into my powershell script IF it's even possible.

Right now my Script is Super Basic, it basically Makes a new VM, A New VHD, sets memory/hd space/etc… for it. But it only gets up to the Install Windows Point (So I am selecting an ISO and booting from that using a Virtual DVD). But Im wondering if there is a way to get past that point.

For reference here is my simple script:

PS C:\Users\mrsmith\Desktop> New-VM -Name "MattTest" -MemoryStartupBytes 2GB -BootDevice CD -SwitchName Lab -path c:\VMdocs -NewVHDSizeBytes 40GB –NewVHDPath c:\base.vhdx

PS C:\Users\mrsmith\Desktop> Set-VMDvdDrive -VMName MattTest -Path C:\ISOFiles\Windows2008.

PS C:\Users\mrsmith\Desktop> Start-VM -Name MattTest

Im testing this on Windows 8 btw, not sure if that matters.

Thanks!

Best Answer

The Windows Deployment Services (WDS) functionality is the "supported" method to do automated installations of server and client OS's in a fully-featured way.

If you don't want to go that heavyweight you could look at building unattended answer files that will be used to automate the setup process. This is also a "supported" process, but you're more "on your own" and it's not a completely integrated solution. (You sound like you're comfortable writing code so this might just be up your alley.)