Re: Service Pack Install Script
- From: "Torgeir Bakken \(MVP\)" <Torgeir.Bakken-spam@xxxxxxxxx>
- Date: Tue, 02 Aug 2005 21:21:42 +0200
Pete wrote:
Hi,
Hopefully someone here can help me with this. I'm using a script to deploy windows 2000 sp4 to a number of computers on an nt4 domain by copying install.cmd to C:\ on each computer and running it using the code below.
I want to get the return value from the install procedure (ie 3010 to indicate reboot required) but the code below returns the installreturn value as soon as the process starts. Is there a way of getting the return value of the installation rather than of the install.cmd?
Set process = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strcomputer & "\root\cimv2:Win32_Process")
installreturn = process.Create("c:\install.cmd",Null,Null,processid)
Set objScriptExec = oShell.Exec("net helpmsg " & installreturn)
installresult = objScriptExec.StdOut.ReadAll
strresult = MsgBox(installresult, vbOK, "Installation on: " & ucase(strcomputer))
Hi,
Here is one way of getting back the result:
Change install.cmd to be like this:
--------------------8<---------------------- @echo off setlocal
set statusfile=c:\spstatus.txt
del "%statusfile%" :: start install of SP4, wait for it to finish start /wait sp4.exe /quiet /norestart or something echo %errorlevel% >"%statusfile%"
--------------------8<----------------------
After your VBScript have launched install.cmd, go unto a loop waiting for the spstatus.txt file to show up on the remote computer (use the admin share and WSH's FileSystemObject to do this).
When spstatus.txt shows up, you know the SP4 installation is finished, and you can use the admin share and WSH's FileSystemObject to read the content of the file to see what return code the SP4 installation returned.
-- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: http://www.microsoft.com/technet/scriptcenter/default.mspx .
- Follow-Ups:
- Re: Service Pack Install Script
- From: Pete
- Re: Service Pack Install Script
- References:
- Service Pack Install Script
- From: Pete
- Service Pack Install Script
- Prev by Date: Re: multiple select form list values using InternetExplorer.Application
- Next by Date: Re: How to read whole by seelcting right Delims
- Previous by thread: Re: Service Pack Install Script
- Next by thread: Re: Service Pack Install Script
- Index(es):
Relevant Pages
|
Loading