I have 2 templates 1 x Windows 2008 R2 1 x Windows 2012 R2

I have sysprep'ed both templates, Generalize / shutdown, etc, etc

On both templates have I the following post-sysprep script that should run upon a new host provisioned from either template



@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('http://repo.myserver.com/chef/winbuild/winconfig.ps1'))"

This script works a treat for the Windows 2008 R2 template

Can anyone answer why this scrip isn't even running for my Windows 2012 R2 template ?

Before you ask, the script was a complex script (which worked on Win2k8R2 template) so I removed that and just created a simple create file, to see if the script was running

like before it worked on Windows 2008 R2 but not Windows 2012 R2

I've looked in sysprep error logs, but this is after sysprep, so I can't see any errors there. I added error handling to my simple create file script and its not even creating the error file, let alone outputting any errors, so I know its not running.

This is the strange thing, if I run setupcommand.cmd, once logged in, it runs perfectly fine, if I run it in ISE it runs perfectly fine, just doesn't run post-sysprep.

I have also noticed that when the image is spinning up, it takes a long time at the "Getting Devices Ready", could this have something to do with it

Any advice would be great

  • Maybe the network is not available at that point, so the script never gets downloaded in the first place? Maybe do -Command " Get-Date | Out-File -Path C:\somepath\log.txt' ; iex #etc " so that you can tell if powershell.exe is even getting invoked. – briantist Jun 16 '15 at 20:30
  • Thanks Brian, I tried something like that, and it wasn't, so looking at maybe moving it to a startup scheduled tasks instead – stravze Jun 18 '15 at 13:18
  • How are you deploying? If you are using MDT or SCCM you could add the script to a post OS installation step in the deployment task sequence. – WinOutreach2 Jun 24 '15 at 15:48

Your Answer

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

Browse other questions tagged or ask your own question.