I got this assignment to automate a the setup of a test lab. The requirements are pretty harsh in my opinion:

  1. Everything has to be contained in one Powershell script.
  2. The required ISO's have to be downloaded from the microsoft download page.
  3. Once the ISO's are downloaded, the setup should initiate and the VM's are created.
  4. When the VM's are created, Windows Server 2012 R2 should be installed on it and from there on things like AD, OM, DHCP and a SQL server should be installed too.

I pretty much got all up until step 4, does anyone know a way to include an AutoUnattend into an ISO with just powershell? or do you have another way to accomplish the automated install of Server 2012?

My very thanks to everyone who wants to help me!

  • Homework question? – BlueCompute Sep 29 '16 at 10:22
  • @BlueCompute nope, It is for my work and I'm out of idea's – Jesse Vermeulen Sep 29 '16 at 10:24
  • Well you can use the ADK to create an autounattend.XML and just put it in the ISO I believe. Why does it all have to be in one powershell script? It seems the stated requirements just make the job harder than it needs to be. – BlueCompute Sep 29 '16 at 10:29
  • @BlueCompute Yep I know, I asked if we could just host sysprepped ISO's ourselves but they wouldn't let me do that. – Jesse Vermeulen Sep 29 '16 at 10:36
  • 2
    Check out Desired State Configuration tools within PowerShell for the post-install configuration. Puppet and Chef are also tools that can help with automated deployments. – Xalorous Sep 29 '16 at 13:33

Use an autounattend xml file for the installation of the OS itself. To my knowledge it's the only way of automating the OS installation itself. You can then write your powershell script to install features and software (which has to be available either on a share or in the image file). Walking you through all the steps or providing a complete answer would be a rather massive post so I'll point you in the right directions at least. You will need to get knowledge on:

  1. Creating an autounattend.xml file
  2. Using DISM (or similar) to edit the .wim file contained in the iso file you have and compile the edited .wim file.
  3. Writing a powershell script to install features and handling restart of your server + resuming a job after a restart
  4. Insert a script file into the image that will automatically launch after installation (Not that difficult, it just needs to be placed in a specific folder on the iso file, google it :) )
  5. Creating a bootable ISO file.

That should about cover it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.