Script to install downloaded windows update
-
Thursday, May 17, 2012 11:27 AM
Hi All,
For ADMT to work on Windows XP i need to install the one Patch Update for Windows XP (KB944043) for all my Windows XP boxex.
So how do i push this one KB Update to all the win xp workstations?
AS
All Replies
-
Thursday, May 17, 2012 1:53 PMModerator
Hi,
You can implement Windows Server Update Services to install patches and updates on your systems.
Bill
- Proposed As Answer by Bill_StewartMicrosoft Community Contributor, Moderator Tuesday, May 22, 2012 5:23 PM
-
Thursday, May 17, 2012 5:18 PM
Hi All,
For ADMT to work on Windows XP i need to install the one Patch Update for Windows XP (KB944043) for all my Windows XP boxex.
So how do i push this one KB Update to all the win xp workstations?
AS
That patch is only required to support RODC. Are you using RODC on any of your sites? If not the patch is not required.
¯\_(ツ)_/¯
-
Friday, May 18, 2012 1:33 AM
Hi all,
Thanks for all the reply but I need the script to run this patch. Found this on the net but how do i input the computer list to install ?
=================================================================
Dim objWMIService, strOS, strOSCaption, strOSServicePack, MSIFileSpec, fso
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set WshShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
strOS = ""
DSSBinLocation = "\\DC1CODENV\patches\"
Set OSSet = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
' Caption value for different OS:
' Microsoft Windows 2000 ...
' Microsoft Windows XP ...
' Microsoft® Windows® Server 2003, ..... Edition
' Microsoft Windows Vista Enterprise
For Each OS in OSSet
strOSCaption = OS.Caption
strOSServicePack = OS.ServicePackMajorVersion
Select Case True
Case InStr(1, strOSCaption, "windows 2000", vbTextCompare) > 0
strOS = "Windows 2000"
Case InStr(1, strOSCaption, "windows xp", vbTextCompare) > 0
strOS = "Windows XP"
Case InStr(1, strOSCaption, "windows® server 2003", vbTextCompare) > 0
strOS = "Windows Server 2003"
Case InStr(1, strOSCaption, "windows vista", vbTextCompare) > 0
strOS = "Windows Vista"
End Select
Next
if strOS = "Windows XP" then
'get version of exist a file being updated and check to see if update needs to be applied.
'no need to reinstall the update at each boot.
'Replace path and file name to check and see if the primary file being updated has been changed or not.
MSIFileSpec = WshShell.ExpandEnvironmentStrings("%SystemRoot%") & "\System32\Netapi32.dll"
If (fso.FileExists(MSIFileSpec)) Then
CurrentFileVersion = fso.GetFileVersion(MSIFileSpec)
End If
CurrentFileVersion = Replace(CurrentFileVersion, ".", "")
'change version number to reflect the version you are going to install
if ((CurrentFileVersion < 5126003462) and (strOSServicePack="2")) or ((CurrentFileVersion <5126005694) and (strOSServicePack="3")) then
'set path and executable name here for the patch and appropriate switches.
'in this case DSSBinLocation is a network path to the patch location.
CommandLine = DSSBinLocation & "WindowsXP-KB944043-v3-x86-ENU.exe/quiet /nobackup /forceappsclose /warnrestart:60"
WshShell.Run CommandLine, 1, false
end if
end if
set OSSet = nothing
set objWMIService =As
- Edited by AUSSUPPORT Friday, May 18, 2012 1:48 AM
-
Friday, May 18, 2012 1:49 AM
Hi all,
Thanks for all the reply but I need the script to run this patch
As
Do you have an RODC? I suspect that you don't. It is only available on demand. In almost all domains this patch is not required to use MDT.
If yuo r4eally want to play with this thenlook in the reposiroty (link on menu) and you willfind many scripts that can deploy software to machines remotely.
YOu cannot install apatch using alogon script or a startup script. YOu can use a remote process but must copy the patch to teh remote system in order to install it.
It is possible to use PowerSHellremoting to install a patch and we can also use PsExec.
There are examples of all of these methods in the repository.
Post back with any question after you have selected a script.
¯\_(ツ)_/¯
-
Saturday, May 19, 2012 6:49 AM
Hi Guys,
I couldn't finsd any script to push single update to multi computers?
is anyone here can help to modify above script for multi computers?
AS
-
Saturday, May 19, 2012 12:25 PM
Start by copying the service pack to every computer using the following template. You will hav eto develop and test it in your own environment as we cannot do that for you.
for /f %%i in ('type servers.txt') do ( md \\%%i\c$\patch copy patchfile.exe \\%%i\c$\patch )Place the above code in a file with a BAT extension. Creatre ethe fiel 'servers.txt' with the names of all of the servers you want to patch.
This will place a copy of the patch on all servers. If ther eis more than one patch version then make multiple copies of this file one for each version.
Once you have successfully deployed the patch files you can use WMI to execute the files remotely using the same server names files.
¯\_(ツ)_/¯
- Edited by jrvMicrosoft Community Contributor Saturday, May 19, 2012 12:27 PM
-
Saturday, May 19, 2012 12:29 PM
Hi Guys,
I couldn't finsd any script to push single update to multi computers?
is anyone here can help to modify above script for multi computers?
AS
The code you posted was developed for a specific type of patching. It is also not complete and will not work remotely.
FOr waht you want just copy the file and run a one or two line WMI vbscript. You do not need to go through so much pain to do this one-time thing.
¯\_(ツ)_/¯
-
Sunday, May 20, 2012 8:39 AMModerator
You can simplify this script you copied of the net. This is the only code you need.
Set WshShell = CreateObject("WScript.Shell") DSSBinLocation = "\\DC1CODENV\patches\" CommandLine = DSSBinLocation & "WindowsXP-KB944043-v3-x86-ENU.exe/quiet /nobackup /forceappsclose /warnrestart:60" WshShell.Run CommandLine, 1, false
This script will need to be run on each XP client. Via login, script, SMS/SCCM, Alteris etc. It will need to run in an administrative context.Blog: http://scriptimus.wordpress.com/
-
Sunday, May 20, 2012 11:16 AM
Once you have successfully deployed the patch files you can use WMI to execute the files remotely using the same server names files.
Pls let me kow this above part?
- Proposed As Answer by Andrew BarnesModerator Wednesday, May 30, 2012 7:45 PM
- Unproposed As Answer by Andrew BarnesModerator Wednesday, May 30, 2012 7:45 PM
-
Sunday, May 20, 2012 11:21 AM
HI Andrew,
I don't have much access to Source Domain. I'm the Target Domain admin. So i need this to push from my end. I have add to their local administrator group and all the XP got me as local admin. So i can push this patch install.
So how do i combine your script with adding the your code with JRV
" for /f %%i in ('type servers.txt') do ( ) "
AS
-
Sunday, May 20, 2012 3:32 PM
Andew - that will likely not work.
You need to copy the file to the target and use WMI Win32_process to excute the patch with the /quiet switch. As an alternate use PsExec.
¯\_(ツ)_/¯
- Edited by jrvMicrosoft Community Contributor Sunday, May 20, 2012 3:36 PM
-
Sunday, May 20, 2012 3:47 PM
HI Andrew,
I don't have much access to Source Domain. I'm the Target Domain admin. So i need this to push from my end. I have add to their local administrator group and all the XP got me as local admin. So i can push this patch install.
So how do i combine your script with adding the your code with JRV
" for /f %%i in ('type servers.txt') do ( ) "
AS
Have up copied the patch. Are you able to copy it. If you are not is the target domain there is a hugh likely hood that you cannot copy this file to teh remote system. That is why I suggested copying it first. If you can copy it then just run the same loop with PsExec to execute the file.
PsExec @servers.txt "c:\patch\patchfile.exe" /quiet
For remote install the /quiet switch is required. Only the /norestart switch can be combined. No other switches will work with /quiet and and you should not use /nobackup when running a remote install.
It is also possible to use PsExec to copy and run the file in one call but some patches may not function when done this way. Coying first avoids this issue.
PsExec @servers.txt -c "c:\localpath\patchfile.exe" /quiet
The -c says to copy the local file to the remote.
http://technet.microsoft.com/en-us/sysinternals/bb897553
Other patch switches need to be chosen based on your required behavior.
I want to note once again. If you are not using RODC which is highly likely then you do NOT need this patch. IF RODCs were installed by Domain Admins they would have installed this patch or your domain would not be working.
¯\_(ツ)_/¯
- Edited by jrvMicrosoft Community Contributor Sunday, May 20, 2012 3:52 PM
- Edited by jrvMicrosoft Community Contributor Sunday, May 20, 2012 3:57 PM
- Edited by jrvMicrosoft Community Contributor Sunday, May 20, 2012 3:58 PM
- Marked As Answer by AUSSUPPORT Thursday, May 31, 2012 5:58 AM
-
Friday, May 25, 2012 3:27 PMModerator
I have used the script linked on this page:
http://www.rlmueller.net/Deploy.htm
to deploy and run any executable (such as one to patch computers) to all computers in a specified group. You would need to create a group with all XP computers as members.
Richard Mueller - MVP Directory Services
- Proposed As Answer by Richard MuellerMVP, Moderator Tuesday, May 29, 2012 5:50 PM

