12Jun Post-build Windows unattended installation script
The last few articles on Digital Formula have been about unattended installations of various Windows components and add-ons. You’ll get most use out of these articles if you take the steps described in them and make up a post-build script that you can run when Windows has finished installing.
The example in this article is for a Windows Server 2003 server that already had a base build of Windows Server 2003 installed along with Windows Server 2003 Service Pack 2, the most current service pack at the time this article was written (June 2008). It’s highly recommended to make sure all the latest critical updates are applied to your system too. I’m aiming this article at Windows Server 2003 because it’s still far more widely used than Windows Server 2008 as of June 2008. I’m also assuming you’ve already downloaded the necessary installation files for the .NET Framework 2.0 x86, .NET Framework 2.0 SP1 x86 and Windows Powershell 1.0. I’m also assuming you’ve got access to the Windows Server 2003 installation media if it’s needed (e.g. for the IIS6 installation).
The sample script below is pretty basic but you can see how combining a couple of unattended installations can speed up the build of a Windows server. It will do the following things.
- An unattended installation of Microsoft .NET Framework 2.0.
- An unattended installation of Microsoft .NET Framework 2.0 Service Pack 1.
- An unattended installation of Windows PowerShell 1.0.
- An unattended installation of IIS6 (see my article on how to perform an unattended installation of IIS6 for details on how to create your answer file).
- Automatically reboot the server when the above installations have finished.
And now, the script.
:: Do some post-build stuff
::
:: Chris Rasmussen
:: June 2008
::
:: Changes:
::
:: Install the .NET Framework 2.0
echo Installing .NET Framework 2.0 …
echo.
“C:\Install\dotnetfx.exe” /q:a /c:”install.exe /qb!”
:: Install the .NET Framework 2.0 SP1
echo Installing .NET Framework 2.0 SP1 …
echo.
“C:\Install\NetFx20SP1_x86.exe” /qb /norestart
:: Install Windows PowerShell 1.0
echo Installing Windows PowerShell 1.0 …
echo.
“C:\Install\WindowsServer2003-KB926139-x86-ENU.exe” /passive /norestart
echo.
:: Install IIS6
echo Installing IIS6 …
echo.
C:\Windows\System32\Sysocmgr.exe /i:%windir%\inf\sysoc.inf /u:C:\Install\iis6.inf
echo.
:: Reboot the server after 10 seconds with an informative message
echo Done! Rebooting …
echo.
shutdown /r /t: 10 /f /c “Post-build automatic reboot”
I’ll put another article up soon about doing the same sort of thing but for Windows Vista/Windows Server 2008.

