Categories
- Arts & Entertainment
- Business
- Communications
- Computers
- Culture & Society
- Disease & Illness
- Fashion
- Finance
- Food & Beverage
- Health & Fitness
- Hobbies
- Home & Family
- Home Based Business
- Internet Business
- Legal
- Pets & Animals
- Politics
- Product Reviews
- Recreation & Sports
- Reference & Education
- Religion
- Self Improvement
- Shopping
- Travel & Leisure
- Vehicles
- Writing & Speaking
Information
Installing Windows Deployment Services (WDS) From a Batch File
Submitted: 2009-09-28 18:02:00
Print this article | Tell a friend | For publisher |
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.
For Windows Server 2003 "Sysocmgr.exe" can be used for automating the add and remove function from the command line. The "equivalent" command for Windows Server 2008 is "ServerManagerCmd.exe".
Relevant of Sysocmgr.exe's options are:
/i:path to Sysoc.inf file, where path to Sysoc.inf file is the full path to the Sysoc.inf file, for example:
/u:path to answer file, where path to answer file is the full path to the answer file that contains a list of items to add or remove.
/q - runs Sysocmgr.exe in quiet mode (without display pages)
/r - suppresses reboot (if needed)
Relevant ServerManagerCmd.exe's options are:
ServerManagerCmd.exe -install <command-Id> [-allSubFeatures] [-resultPath <result.xml> [-restart] | -whatIf] [-logPath <log.txt>]
Installs the role, role service, or feature specified by Id. The identifiers are case-insensitive.
The following optional parameters are used with the -install parameter.
-setting <setting name>=<setting value> – Specify required settings for the installation.
-allSubFeatures – Specify the installation of all subordinate services and features along with the parent role, role service, or feature named in the -install command's Id parameter. Note that some role containers do not have a command line identifier to allow installation of all role services. This is the case when role services cannot be installed in the same instance of the Server Manager command. For example, the Federation Service role service of Active Directory Federation Services and the Federation Service Proxy role service cannot be installed by using the same Server Manager command instance.
-resultPath <result.xml> – Saves installation results to an XML file represented by result.xml. You can also use the short form of this parameter, -r. You cannot use the -resultPath parameter and the -whatIf parameter in the same instance of ServerManagerCmd.exe.
-restart – Adding -restart to the -install command restarts the computer automatically when installation is complete, if restarting is required by the roles or features installed.
-whatIf – You can use -whatIf to display any operations specified for the -install command. You can also use the short form of the -whatIf parameter, -w. You cannot use the -resultPath parameter and the -whatIf parameter in the same instance of ServerManagerCmd.exe.
-logPath <log.txt> – Use -logPath to specify a name and location for the log file, other than the default, %windir%\temp\servermanager.log.
I started by adding all files required by WDS to the DFS and I created the following batch file.
* * * * * * * * * * * * * * * * * * * * START* * * * * * * * * * * * * * * * * * * *
@ECHO OFF
REG EXPORT "HKLMSOFTWAREMicrosoftWindowsCurrentVersionSetup" %WINDIR%\InstallWDS.reg /y
REG ADD "HKLM\SOFTWAREMicrosoftWindowsCurrentVersionSetup" /v "SourcePath" /t REG_SZ /d "\\SERVERNAME\SHARE" /f
REG ADD "HKLMSOFTWAREMicrosoftWindowsCurrentVersionSetup" /v "ServicePackSourcePath" /t REG_SZ /d "\\SERVERNAME\SHARE" /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 /r
GoTo CleanUp
:Win2008
ServerManagerCmd -install WDS
GoTo CleanUp
:CleanUp
REG IMPORT %WINDIR%\InstallWDS.reg
DEL %WINDIR%\InstallWDS.inf
DEL %WINDIR%\InstallWDS.reg
* * * * * * * * * * * * * * * * * * * * END * * * * * * * * * * * * * * * * * * * *
The basic steps are:
1) Backup registry key to "InstallWDS.reg" - This is used to backup original OS file path and service pack path
2) Set cached paths for OS and service pack files ("\\SERVERNAME\SHARE" which is UNC path to files)
3) Execute the command for installation of component on the detected OS - Note that for Windows 2003 a file called "InstallWDS.inf" is created
4) Restore registry key backup from step 1
5) Delete "InstallWDS.inf" required by Windows 2003
6) Delete registry key backup file "InstallWDS.reg"
This batch can easily be modified to install virtually any Windows component or server role
Shaun Vermaak is an IT Consultant specializing in various Microsoft technologies
www.ITtelligence.co.za
Article source: Expert Articles
Most Recent Articles in Scripts category
- Installing Windows Deployment Services (WDS) From a Batch File - By: Shaun Vermaak
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. - PHP Shopping Cart - By: Natisha Nel
ASP or Active Server Pages is from Microsoft's treasure trove of programming languages. - Search APIs - Creating Your Own Custom Search Engine - By: Reshmi Prakashan
Search APIs provided from various search engines like - Google, Yahoo, Gigablast, Dhoondho helps users/programmers Create their own search engine or basically innovate using Search Technologies to tap into the vast power of the Internet Information System. We look at a few API Providers in this article to see how they fare against each other - Asp Scripts Component - By: Robert Williams
We are provided free classified business online directory services. Add top tips comments, top tips advice for business services and tips for beauty.
