Chris Rasmussen · Infrastructure Guy · Code Dabbler · Photographer · Traveller

Follow Up – Post-build Windows unattended installation script

Back in June 2008 I posted an article about running post-build commands after Windows setup completes. Recently a viewer asked the following question:

How would you go about having the unattend.xml automatically call this script?

Although the method below doesn’t use unattend.xml directly, here’s a way of running a script after Windows setup completes …

After Windows setup completes successfully Windows will look for a script named SetupComplete.cmd in the %WINDIR%\Setup\Scripts\ folder. If this script exists it will be run – post-build commands can be added to that script (create the script if it doesn’t already exist).

Important notes:

- If, for example, your Windows unattended installation source is C:\Source\i386 you would create a folder called “C:\Source\i386\$OEM$\$1\Windows\Setup\Scripts” (without the quotes) and put the SetupComplete.cmd in there. During an unattended installation the entire contents of C:\Source\i386\$OEM$\$1 will be copied to C:\. This also assumes you are installing Windows to C:\Windows – if your location is different you must change the \Windows\Setup\Scripts path above to match your configuration.
- The commands in the SetupComplete.cmd script are executed with local system privilege so it’s a good place to do post-build installations or customisations.
- You CANNOT reboot and continue the actions in SetupComplete.cmd so do not run commands that require a reboot before continuing (e.g. an installation that updates Windows or a program install that forces a reboot).
- Setup won’t verify any exit codes or levels from SetupComplete.cmd either (normally you’d use these to see if the script executed correctly).

This is a very useful way of running post-build commands after Windows setup completes successfully and I’d recommend it for your unattended builds (I use it a lot).

  • Share/Bookmark

Related posts:

  1. Post-build Windows unattended installation script The last few articles on Digital Formula have been about...
  2. Follow up – How to perform an unattended installation of the .NET Framework 2.0 Some time ago I wrote an article about how to...
  3. How to perform an unattended installation of SNMP on Windows Server 2003 Continuing with the recent history of unattended installation articles, this...
  4. Follow-up to VB.NET full-screen application post Quite some time ago I posted an article called "How...
  5. Windows XP unattended install keeps asking for Plug and Play monitor driver As far as I know the majority of businesses using...

banner ad

5 Responses to “Follow Up – Post-build Windows unattended installation script”

  1. com2 says:

    Very nice, thank you, thank you, thank you!!!!

  2. Joey says:

    Also check out SendKeys.NET. I’ve used it for a year now in building keyboard macros embedded in install scripts. Very helpful when something has a pop up message or needs info to be typed. I like it cause it embeds nicely into a batch file.

    http://sendkeysnet.blogspot.com

  3. Bill says:

    Thanks for the Info Chris, Been using the SetupComplete.cmd in my Scripts folder for my Windows 7 and the applications with the
    switches run great,can add Registry entries plus I am able to remove application folders and files after the installs as well, But having one small problem, I need to install a read file or folder to the windows desktop but the permissions or not having a elevated command wont let me.Any Ideas on this would be great! As I said I can use the RMDIR and Del command but the MKDIR and XCopy will not work.

  4. Antonio says:

    For Bill:
    You can use utility called CPAU.EXE and a tips of script unattended (thx Chris)
    Search in google.
    ;-)
    I think is best solution for you.
    Antonio

Leave a Reply

Powered by Wordpress | Designed by Elegant Themes