Shopping Product Reviews

Installing Windows Deployment Services (WDS) from a batch file

I needed to install WDS on over 300 servers, but found that the server build did not have a local copy of the OS configuration or service pack files. I also wanted to reset the paths to the original values.

I started by adding all the files required by WDS to the DFS and created the following batch file.

**********BEGINNING**********
@ECO OFF

REG EXPORT “HKLMSOFTWAREMicrosoftWindowsCurrentVersionSetup” %WINDIR%InstallWDS.reg /y
REG ADD “HKLMSOFTWAREMicrosoftWindowsCurrentVersionSetup” /v “SourcePath” /t REG_SZ /d “SERVERNAMESHARE” /f
REG ADD “HKLMSOFTWAREMicrosoftWindowsCurrentVersionSetup” /v “ServicePackSourcePath” /t REG_SZ /d “SERVERNAMESHARE” /f

SEE | Search for “Microsoft Windows [Version 5.2.” > nul
If %ERRORLEVEL% == 0 GoTo Win2003
VER | Find “Microsoft Windows [Version 6.0.” > nul
If %ERRORLEVEL% == 0 GoTo Win2008

GoTo CleanUp

:Win2003
ECHO [Components] > %WINDIR%InstallWDS.inf
ECHO RemInst=enabled >> %WINDIR%InstallWDS.inf
Sysocmgr.exe /i:sysoc.inf /u:%WINDIR%InstallWDS.inf
go to cleaning

:Win2008
ServerManagerCmd -install WDS
go to cleaning

:Clean up
REG IMPORT %WINDIR%InstallWDS.reg
DEL %WINDIR%InstallWDS.inf
DEL %WINDIR%InstallWDS.reg
**********FINAL**********

The basic steps are:
1) Backup the registry key to “InstallWDS.reg”
2) Set the cache paths for the OS and service pack files (SERVERNAMESHARE, which is the UNC path to the files)
3) Run the command to install the component on the detected operating system. Note that for Windows 2003 a file called “InstallWDS.inf” is created.
4) Restore the registry key backup from step 1
5) Remove “InstallWDS.inf” required by Windows 2003
6) Delete the registry key backup file “InstallWDS.reg”

This batch can be easily modified to install virtually any Windows component

Leave a Reply

Your email address will not be published. Required fields are marked *