3

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!

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
  • Do you need to install Windows every time, or would it be better cloning a template image? – tombull89 Mar 07 '13 at 13:20
  • Well its actually for setting up Test Servers through VIrtual Machine...so ya ill be installing windows each time. –  Mar 07 '13 at 13:21

2 Answers2

3

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.)

Evan Anderson
  • 141,071
  • 19
  • 191
  • 328
  • So essentially i'd be doing the same process, except just my ISO would have an unattended answer file basically so once it gets to the "Install Windows" Screen it would take over? –  Mar 07 '13 at 13:30
  • 1
    That's correct. – Evan Anderson Mar 07 '13 at 13:37
  • Well awesome. That makes things alot easier! –  Mar 07 '13 at 13:46
  • 1
    I think you'll like unattended answer files. If your project gets larger and needs to scale to more sysadmins you might find the WDS tools will be a better fit because they abstract away the details more than just writing answer files. – Evan Anderson Mar 07 '13 at 13:51
2

What you need to do is create a DVD image that has an answer file built into it to answer all the questions asked by windows 8. This is called an "unattended install".

You could either add it to your ISO and carry on with your script, or potentially have your script generate the needed files and add them to the ISO.

I don't have a particular guide handy for windows 8 since I'm still working with windows 7, but technet has quite a few resources here, and searching for "windows 8 unattended install" should be enough to get you started.

Unless you actually need to test things at the windows setup level, creating a base virtual machine with a fresh install of windows and cloning that each time would probably be faster.

Grant
  • 17,671
  • 14
  • 69
  • 101