mlazovjp wrote:
> Working on making a completely automated install of Windows and
> all relevant updates, applications, etc.
>
> I was able to find the Windows Update Agent v2.0 redistributable
> file, which allows me to install the new Windows Update v6
> ActiveX control on a computer without having to visit
> windowupdate.microsoft.com and agree to update the control, etc etc.
> http://msdn.microsoft.com/library/de...date_agent.asp
>
> Is there something similar I can download and install that will
> configure Microsoft Update for a computer without haviong to visit
> the Microsoft Update web page?
Hi,
For x86-based computers (WindowsUpdateAgent20-x86.exe)
http://go.microsoft.com/fwlink/?LinkId=43264
(will work for Win2k SP3 and SP4, WinXP RTM/SP1/SP2, and
Win2k3 RTM/SP1)
For x64-based computers (WindowsUpdateAgent20-x64.exe):
http://go.microsoft.com/fwlink/?LinkId=43265
The VBScript below checks if the new AU client is needed on the
computer (by checking the version of wuaueng.dll), and runs
WindowsUpdateAgent20-x86.exe if so (in silent mode).
Adjust path in the sExePath variable if necessary.
'--------------------8<----------------------
' prefix with an UNC path if necessary
sExePath = "WindowsUpdateAgent20-x86.exe"
Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
' path to the Windows system32 folder
sWinSysDir = oFSO.GetSpecialFolder(1).Path
sDllFile = sWinSysDir & "\wuaueng.dll"
bUpdateNeeded = True ' init value
If oFSO.FileExists(sDllFile) Then
If Not CompareFileVersions(sDllFile, "5.8.0.2469") = "SecondFileNewest" Then
bUpdateNeeded = False
End If
End If
If bUpdateNeeded Then
' stop the Automatic Updates service
oShell.Run "%SystemRoot%\system32\net.exe stop wuauserv", 0, True
' install the AU client
oShell.Run sExePath & " /quiet /norestart", 1, True
End If
Function CompareFileVersions(sFileInfo1, sFileInfo2)
Dim oFSO, sFileVer1, sFileVer2, aFileVer1, aFileVer2, iCount, iDateDiff
Set oFSO = CreateObject("Scripting.FileSystemObject")
If sFileInfo1 = "" Or sFileInfo2 = "" Then
MsgBox _
"CompareFileVersions error: Invalid argument, empty argument given!", _
vbExclamation + vbSystemModal, "CompareFileVersions"
Err.Raise 5 'Invalid procedure call or argument
End If
If oFSO.FileExists(sFileInfo1) Then
sFileVer1 = oFSO.GetFileVersion(sFileInfo1)
Elseif UBound(Split(sFileInfo1, ".")) = 3 Then
sFileVer1 = sFileInfo1
Else
MsgBox "CompareFileVersions error: 1. argument is not an existing " _
& "file or correct file version format: " & sFileInfo1, _
vbExclamation + vbSystemModal, "CompareFileVersions"
Err.Raise 5 'Invalid procedure call or argument
End If
If oFSO.FileExists(sFileInfo2) Then
sFileVer2 = oFSO.GetFileVersion(sFileInfo2)
Elseif UBound(Split(sFileInfo2, ".")) = 3 Then
sFileVer2 = sFileInfo2
Else
MsgBox "CompareFileVersions error: 2. argument is not an existing " _
& "file or correct file version format: " & sFileInfo2, _
vbExclamation + vbSystemModal, "CompareFileVersions"
Err.Raise 5 'Invalid procedure call or argument
End If
If sFileVer1 <> "" And sFileVer2 <> "" Then
If sFileVer1 = sFileVer2 Then
CompareFileVersions = "SameVersion"
Else
aFileVer1 = Split(sFileVer1, ".")
aFileVer2 = Split(sFileVer2, ".")
For iCount = 0 To 3
If CInt(aFileVer1(iCount)) > CInt(aFileVer2(iCount)) Then
CompareFileVersions = "FirstFileNewest"
Exit For
ElseIf CInt(aFileVer1(iCount)) < CInt(aFileVer2(iCount)) Then
CompareFileVersions = "SecondFileNewest"
Exit For
Else
CompareFileVersions = "UnknownStatus"
End If
Next
End If
Elseif sFileVer1 <> "" And sFileVer2 = "" Then
CompareFileVersions = "FirstFileNewest"
Elseif sFileVer1 = "" And sFileVer2 <> "" Then
CompareFileVersions = "SecondFileNewest"
Else
iDateDiff = DateDiff("s", oFSO.GetFile(sFileInfo1).DateLastModified, _
oFSO.GetFile(sFileInfo2).DateLastModified)
If iDateDiff < 0 Then
CompareFileVersions = "FirstFileNewest"
ElseIf iDateDiff > 0 Then
CompareFileVersions = "SecondFileNewest"
Else
CompareFileVersions = "SameVersion"
End If
End If
End Function
'--------------------8<----------------------
WSH 5.6 documentation (local help file) can be downloaded from here
if you haven't got it already:
http://msdn.microsoft.com/downloads/list/webdev.asp
--
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/scr...r/default.mspx