Hi there..
I am trying to write a script to install a hotfix on a remote machine from a list of hostnames.
I have the following code, which almost works, but installs the SW on the local machine!!
Here is my code:
The calling script is:
Can anyone point me in the right direction please??
I am trying to write a script to install a hotfix on a remote machine from a list of hostnames.
I have the following code, which almost works, but installs the SW on the local machine!!
Here is my code:
Code:
For intLoop = 1 To intMachineMax
sOS = CMDCapture(sTools & "Reg Query " & Chr(34) & sKeyOS & Chr(34) & " \\" & strMachines(intloop))
sValue = CMDCapture(sTools & "Reg Query " & sKeyMDAC & "/ve \\" & strMachines(intloop))
oLog.Writeline("Host,OS,Version")
If InStr(sOS, 5.1) Then
sOS = "Microsoft Windows XP Professional"
ElseIf InStr(sOS, 5.0) Then
sOS = "Microsoft Windows 2000"
Else
sOS = "Microsoft Windows NT"
End If
WScript.Echo sOS
If InStr(sValue, 2.5) Then
sValue = "MDAC v2.5"
ElseIf InStr(sValue, 2.6) Then
sValue = "MDAC v2.6"
ElseIf InStr(sValue, 2.7) Then
sValue = "MDAC v2.7"
ElseIf InStr(sValue, 2.8) Then
sValue = "MDAC v2.8"
Elseif InStr(sValue, "registry key") Then
'MDAC not installed, so don't pull the fix
WScript.Quit
End If
WshShell.Run(FixLoc & "Q832483.vbs")
oLog.writeline(strmachines(intloop) & "," & sOS & "," & sValue)
next
The calling script is:
Code:
'Path to HotFix
Const FixLoc = "\\MyServer\HOTFIXES\MDAC\Q832483\"
'Registry to store hot fix info
Const KeyPath = "HKLM\Software\NON Windows Installer\Hotfixes\"
'HotFix ID (key in Reg)
Const KeyVal = "Q832483"
'HotFix MSO Number
Const MSO = "MS04-003"
Const ScriptTools = "\\MyServer\ScriptTools\"
Const ForReading = 1, ForWriting = 2
Dim sCMD
Set wshShell = CreateObject("Wscript.Shell")
Set WshSysEnv = wshShell.Environment("Process")
sLocalName = UCase(WshSysEnv("COMPUTERNAME"))
sCMD = "cmd /c " & FixLoc & "ENU_Q832483_MDAC_X86.EXE /C:" & chr(34) & "dahotfix.exe /q /n" & Chr(34) & " /q"
If KeyExists (KeyPath & MSO & "\" & KeyVal) = False Then
wshShell.run sCMD, 7, True
wshShell.RegWrite KeyPath & MSO & "\" & KeyVal, "Installed on " & Now & " From: " & FixLoc & sCmd, "REG_SZ"
End if
' To check if a registry value exists
Public Function KeyExists(key)
Dim key2
On Error Resume Next
key2 = wshShell.RegRead(key)
If err <> 0 Then
KeyExists = False
Else
KeyExists = True
End If
End Function
Can anyone point me in the right direction please??