Install windows component (VBScript)
This code can be found in
Chapter 2 of Windows Server Cookbook
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the VBScript code from this site.
' This code simulates the same steps from the command-line solution.
' First an answer file is created containing the parameters to install
' the DNS Server. Then the sysocmgr command is invoked to perform the
' installation.
' ---------------------------------------------------------------
' From the book "Windows Server Cookbook" by Robbie Allen
' ISBN: 0-596-00633-0
' ---------------------------------------------------------------
strFile = "c:\comp_install.txt"
constForWriting = 2
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.OpenTextFile(strFile, constForWriting, True)
objFile.WriteLine("[netoptionalcomponents]")
objFile.WriteLine("dns=1")
objFile.Close
set objWshShell = WScript.CreateObject("WScript.Shell")
intRC = objWshShell.Run("sysocmgr /i:%windir%\inf\sysoc.inf /u:" & _
strFile, 0, TRUE)
if intRC <> 0 then
WScript.Echo "Error returned from sysocmgr command: " & intRC
else
WScript.Echo "Windows Component installed"
end if
|
This code has been viewed 2490 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|