Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Installing hotfixes with VB

Status
Not open for further replies.

josephk73

Technical User
Aug 1, 2002
115
GB
Hi,

I have the task to install hotfixes on servers and would like to know the best way to do this. I will use a text file to store the computer names and a folder to store the hotfixes.

I can do the first part of the task which is to use the text file that will store the computer names as an argument to the script file. I also feel confident that I would be able to access the directory containing the hotfixes.

So my real question, is there any 'gotchas' that I should be aware of? For example I've only just found out that I will need qchains.exe to deploy the hotfixes without re-booting the computer between each hotfix deployment. So if anybody has done this sort of thing in the past, could you let me know the steps I need to take? I dont need the script written for me per se (although that would be nice:), but really just a list of steps that I need to follow.

Any advice would be great.
 
I use a method of installing updates/hotfixes via Scheduled Task. Essentially, every PC in the office has a scheduled task set up under the Administrator account to run every night (varying times) to connect to a share, run a bat file to do the updates, then reboot. Saves on the shoe leather.

The task "update.cmd" is:
--------------------------------------
net use s: \\10.45.116.69\systems
s:\run.bat
--------------------------------------
The "run.bat" file is:
--------------------------------------
@echo off

REM Create update directory

if not exist c:\update md c:\update > nul

REM Additional setup routines

if not exist c:\delfold.vbs copy s:\delfold.vbs c:\ > nul
if not exist c:\reboot.vbs copy s:\reboot.vbs c:\ > nul
if not exist c:\Cleanup.bat copy s:\Cleanup.bat c:\ > nul

REM --- Program execution routines

REM First check for appropriate flag file
REM Edit this section for each update flag

if exist c:\flags\job.flg goto Cleanup

REM Copy the files from the share drive to local drive

xcopy s:\programs\*.* /s /e c:\update > nul

REM Run update programs

c:
cd\update
REM change this line to your update prog/s

REM Copy flag file to indicate job done

copy c:\update\job.flg c:\Flags > nul
echo Done > s:\flags\%COMPUTERNAME%.flg

REM --- End of Program execution

REM --- Cleanup begins

:Cleanup

c:
cd Cleanup.bat
----------------------------------------
The cleanup.bat file is:
----------------------------------------
:Disconnect

net use s: /delete

:Cleanup

c:
cd delfold.vbs

:End

c:
cd reboot.vbs
--------------------------------------
The "delfold.vbs" file is:
--------------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFolders = objWMIService.ExecQuery ("Select * from Win32_Directory where Name = 'c:\\Update'")
For Each objFolder in colFolders
errResults = objFolder.Delete
Next
---------------------------------------
The "reboot.vbs" file is:
---------------------------------------
On Error Resume Next

strComputer = "."

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Reboot()
Next
----------------------------------------

 
Your best bet is to avoid VBScript and use Microsoft SUS server. It's a free download and SUS stands for Software Update Server.
 
Thanx Nullig,

Will give it a go and let you know how I get on

Ta!!!
 
VBScript isn't to hard to use if it works Great if not, SUS server is lot harder to set up tobegin updates. check out froms about Microsoft: Windows servers useing SUS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top