Re: Update patches in a network
- From: per.larsson@xxxxxxxxxx
- Date: 25 Aug 2005 05:05:29 -0700
Hi Lieven,
I have done it for the most critical patches we needed to get out. The
MS patches are created in different ways. Some of them accept batch
mode parameters that allow you to make it run silently and not restart
the computer after eatch patch, some dont. It will get qite messy if
you want to handle all your patching this way.
I would look into SUS or WSUS.
Here are my scripts if you can use them:
The first script does the job, the second script runs the first one
with local admin privileges.
You will need to create the user "yourDomain\Patchinst" who has local
admin previllages in the clients.
------------------------------------------------
'* Installes patches
Dim sp, key, sd, ver, iever, ie
Set WshShell = WScript.CreateObject("WScript.Shell")
On error resume next
sp = WshShell.RegRead("HKLM\Software\Microsoft\Windows
NT\CurrentVersion\CSDVersion")
ver = WshShell.RegRead("HKLM\Software\Microsoft\Windows
NT\CurrentVersion\CurrentVersion")
iever = WshShell.RegRead("HKLM\Software\Microsoft\Internet
Explorer\Version")
sd = False
If ver = "5.0" Then
If right (sp,1) > 2 Then
'*** Patch KB823980
Key = "A"
key = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Updates\Windows
2000\SP5\KB823980\Type")
If key = "A" Then
WshShell.Popup "Installs Patch KB823980" & Chr(13) & "Takes a
minute. Then restart.", 4, "Allways be safe", 64
WshShell.Run "p:\fasttrack\patchar\Windows2000-KB823980-x86-ENU.exe
-u -z", 1, true
sd = True
End if
'*** Patch KB828749
Key = "A"
key = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Updates\Windows
2000\SP5\KB828749\type")
If key = "A" Then
WshShell.Popup "Installes Patch KB828749" & Chr(13) & "Takes a
minute. Then restart.", 4, "Allways be safe", 64
WshShell.Run "p:\fasttrack\patchar\Windows2000-KB828749-x86-ENU.exe
-u -z", 1, true
sd = true
End if
'*** Patch Q810833
If right (sp,1) < 4 Then
Key = "A"
key = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Updates\Windows
2000\SP4\Q810833\type")
If key = "A" Then
WshShell.Popup "Installes Patch Q810833" & Chr(13) & "Takes a
minute. Then restart.", 4, "Safetybelt", 64
WshShell.Run "p:\fasttrack\patchar\Q810833_W2K_SP4_X86_EN.exe -u
-z", 1, true
sd = true
End if
End if
'*** Internet Explorer patch Q818506.
If left (iever,3) = "6.0" Then
ie =
WshShell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\MinorVersion")
If instr(1, ie, "SP1") <> 0 Then
If instr(1, ie, "Q818506") = 0 Then
WshShell.Popup "Installes Internet Explorer patch Q818506" &
Chr(13) & "Takes seconds. Then restart.", 4, "Hi!", 64
WshShell.Run "p:\fasttrack\patchar\Q818506.exe -q", 1, false
wscript.sleep 5000 '*** Waits for installation.
WshShell.AppActivate ("Q818506.exe")
WshShell.sendkeys "{%}n" '***Answers No to GUI question "Do you
want to restart now?"
sd = true
End if
End if
End if
'*** Internet Explorer patch Q833989.
' If left (iever,3) = "6.0" Then
' ie =
WshShell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\MinorVersion")
' If instr(1, ie, "SP1") <> 0 Then
' If instr(1, ie, "Q833989") = 0 Then
' WshShell.Popup "Installes Internet Explorer patch Q833989" &
Chr(13) & "Takes seconds. Then restart.", 4, "Get safe", 64
' WshShell.Run "p:\fasttrack\patchar\IE6.0sp1-KB833989-x86-ENU.exe
-q", 1, false
' sd = true
' Wscript.sleep 20000 '*** Waits for installation.
' WshShell.AppActivate ("IE6.0sp1-KB833989-x86-ENU.exe")
' WshShell.sendkeys "{%}n" '*** Answers No to Restart...
' End if
' End if
' End if
Else
'*** Tells if the computer has les than SP3
If WshShell.RegRead("HKLM\Software\Microsoft\Windows
NT\CurrentVersion\CurrentVersion") = "5.0" Then
If right(WshShell.RegRead("HKLM\Software\Microsoft\Windows
NT\CurrentVersion\CSDVersion"),1) < 3 Then
WshShell.Popup "This computer needs a later servicepack!!!" &
Chr(13) & "Make shure it is done!",, "OBS!", 16
End if
End if
End if
'*** Restart if anything is installed.
If sd = true Then
WshShell.Run "p:\fasttrack\bin\shutdown.exe /L /R /T:10 " & Chr(34) &
"The computer will restart to activate Patches..." & Chr(34) & " /C",
1, false
End if
End if
------------------------------------------------------
Second script:
---------------------------
'* Runs the script patch.vbs as user "patchinst"
wscript.sleep(20000)
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "runas.exe /user:samhallit\patchinst ""wscript.exe
p:\fasttrack\bin\patchar.vbs""", 1, false
wscript.sleep(1000)
Wshshell.sendkeys "yourPassword"
Wshshell.sendkeys "~"
------------------------------------------------------
--------------------------------------------------------
.
- Follow-Ups:
- Re: Update patches in a network
- From: Bernie Hunt
- Re: Update patches in a network
- References:
- Update patches in a network
- From: lieven
- Update patches in a network
- Prev by Date: Re: Why does the msgbox does not work?
- Next by Date: Take ownership using ADsSecurityUtility
- Previous by thread: Update patches in a network
- Next by thread: Re: Update patches in a network
- Index(es):
Relevant Pages
|
|