InstallWDS – Installing Windows Deployment Services (WDS) from a batch file

Installing Windows Deployment Services (WDS) from a batch file

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

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

[sourcecode language=”plain”]
@ECHO 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

VER | Find "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 = on >> %WINDIR%InstallWDS.inf
Sysocmgr.exe /i:sysoc.inf /u:%WINDIR%InstallWDS.inf
GoTo CleanUp

:Win2008
ServerManagerCmd -install WDS
GoTo CleanUp

:CleanUp
REG IMPORT %WINDIR%InstallWDS.reg
DEL %WINDIR%InstallWDS.inf
DEL %WINDIR%InstallWDS.reg
[/sourcecode]

Attachment(s):
[list-attachments]

MoveSysvol – Automate the relocation of the Sysvol folder

MoveSysvol automated by Shaun Vermaak is a batch to automatically relocate the Sysvol folder as per http://support.microsoft.com/kb/842162

The following must be in the working folder or in path:
MoveSysvol.bat
SetFRS.vbs
sysvol.inf
linkd.exe (Not included)
robocopy.exe (Not included)

Usage: MoveSysvol.bat OLDSYSVOLPATH NEWSYSVOLPATH DOMAINFQDN
Example: MoveSysvol.bat C:WindowsSYSVOL D:SYSVOL TESTDOMAIN.COM

Attachment(s):
[list-attachments]

CommandThreader – Execute any list of commands threaded into as many threads as needed (Updated)

CommandThreader by Shaun Vermaak is a command line tool that makes it possible to execute any list of commands threaded into as many threads as needed.

03/05/2009 – Fixed thread IDs
24/11/2008 – Added line numbers
03/11/2008 – Minor bug fixes

Usage: CommandThreader.exe NUMBER_OF_THREADS INPUT_FILE.TXT
Lines in INPUT_FILE.TXT must be in format COMMAND|ARGUMENT|WORKING_DIRECTORY|HIDDEN|TIMEOUT

Example: PSEXEC.exe|\192.168.0.1 -c -d -f Program.exe||True|1000

Attachment(s):
[list-attachments]

SetDevicePath – Automates the building of the DevicePath variable in registry from a specified path

SetDevicePath by Shaun Vermaak is a script to automatically build the DevicePath variable in registry from a specified path
. Very useful in SysPrep process (Replaces OEMPnpDriversPath in SysPrep.inf)

Usage: CScript SetDevicePath.vbs /DriverFolder:PATHTODRIVERS

Attachment(s):
[list-attachments]

GenStr – Random string generator

GenStr by Shaun Vermaak generates random strings for passwords and pre-share keywords

Usage: GenStr.exe Aag1! LENGTH COUNT
A = Generate string with only A,B,C,D,E,F (UPPERCASE affects whole string)
a = Generate string with only a,b,c,d,e,f (lowercase affects whole string)
g/G = Include alphabetical in generated string
1 = Include numerics in generated string
Exclamation = Include special characters
LENGTH = Length of generated string
COUNT = Number of strings to generate

Attachment(s):
[list-attachments]

MailboxCreationTime – Get the mailbox creation timestamp from a Microsoft Exchange Server

MailboxCreationTime by Shaun Vermaak (modified from broken script by unknown author) is a script to get the mailbox creation timestamp from a Microsoft Exchange Server.

Note that it must be executed in the context of an user account that has full mailbox rights

Usage: CScript.exe MailboxCreationTime.vbs /ServerName:SERVERNAME

Attachment(s):
[list-attachments]

CircularLogArchiver – Automates the archiving of logs with the help of 7Zip

CircularLogArchiver by Shaun Vermaak automates the archiving of logs with the help of 7Zip.
It’s particularly useful on large log directories were space is an issue.

Usage: CircularLogArchiver.exe GO /LP:LogPath /LE:LogExtention /AI:Interval /AOT:ArchiveOlderThan /DAOT:DontArchiveOlderThan /DOT:DeleteOlderThan
Example: CircularLogArchiver.exe GO /LP:”C:Logs” /LE:”*.log” /AI:”M” /AOT:”1″ /DAOT:”3″ /DOT:”3″
Example above will archive all files in “C:Logs” with *.log extention that are between one and three months old and delete files older than three months

Attachment(s):
[list-attachments]