I have this script below that will install software or upgrade that software depending on what the script finds. Before the user can login it, if the computer does not have the software, or needs to have it upgraded then it takes forever to get the login box due to it saying running start up scripts. I was wondering if there is anything below that can be tweaked that will make the script run, but also make sure that both .MSI files run after the other. The xcopy files will need to be transfered first to ensure the setup can launch. Any suggestions? Thanks!
Set wshShell = WScript.CreateObject("WSCript.shell")
Dim returnval
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
strOS = wshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName")
If strOS = "Microsoft Windows XP" or Left(strOS,9) = "Windows 7 Professional" Then
'*********************************************************************************
'Lets Check for GEdge and see if it is installed. If not, lets install it.
'*********************************************************************************
If strOS = "Microsoft Windows XP" Then
If Not RegKeyExists("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7EDD1CCA-F75D-4DB2-A958-B2E83C840EAF}") Then
wshShell.Run "xcopy ""\\server\deploy$\GEdge\GEdge Framework Client.msi"" C:\Install\GEdge\ /Y",0,True
wshShell.Run "xcopy ""\\server\deploy$\GEdge\GEdge Hard Disk Client.msi"" C:\Install\GEdge\ /Y",0,True
WshShell.Run "msiexec /i ""C:\Install\GEdge\GEdge Framework Client.msi"" /q REBOOT=ReallySuppress",0,True
WshShell.Run "msiexec /i ""C:\Install\GEdge\GEdge Hard Disk Client.msi"" /q REBOOT=ReallySuppress",0
Else
'**************************************************************************************************************
'Lets check if the version is current, if not lets upgrade - Version must be changed below in quotes. "9.5.0"
'**************************************************************************************************************
returnval= WSHShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\GE\Framework\ProductVersion")
If instr(returnval, "9.5.0") > 0 then
'---=== Version is recent, so lets do nothing. Have a great day!
Wscript.Quit
Else
'---=== Let's update this GEdge
wshShell.Run "xcopy ""\\server\deploy$\GuardianEdge\GuardianEdge Framework Client.msi"" C:\Install\GuardianEdge\ /Y",0,True
wshShell.Run "xcopy ""\\server\deploy$\GEdge\GEdge Hard Disk Client.msi"" C:\Install\GEdge\ /Y",0,True
WshShell.Run "msiexec /i ""C:\Install\GEdge\GEdge Framework Client.msi"" /q REINSTALL=ALL REINSTALLMODE=vomus REBOOT=ReallySuppress",0,True
WshShell.Run "msiexec /i ""C:\Install\GEdge\GEdge Hard Disk Client.msi"" /q REINSTALL=ALL REINSTALLMODE=vomus REBOOT=ReallySuppress",0
End if
End If
End If
End If
Set wshShell = Nothing
Set objWMIService = Nothing
Function RegKeyExists(strName)
Const NO_EXISTING_KEY = "HKEY_NO_EXISTING\Key\"
Dim objWsh
Dim strKeyPath
Dim strNoKeyError
Set objWsh = WScript.CreateObject("WScript.Shell")
strKeyPath = Trim(strName)
If Right(strKeyPath, 1) <> "\" Then strKeyPath = strKeyPath & "\"
On Error Resume Next
' Get the error description by trying to read a non-existent key
objWsh.RegRead NO_EXISTING_KEY
strNoKeyError = Err.Description
Err.Clear
objWsh.RegRead strKeyPath
' Compare the error description with the previous determined sample
If Replace(Err.Description, strKeyPath, _
NO_EXISTING_KEY) = strNoKeyError Then
RegKeyExists = False
Else
RegKeyExists = True
End If
Err.Clear
On Error Goto 0
Set objWsh = Nothing
End Function
Set wshShell = WScript.CreateObject("WSCript.shell")
Dim returnval
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
strOS = wshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName")
If strOS = "Microsoft Windows XP" or Left(strOS,9) = "Windows 7 Professional" Then
'*********************************************************************************
'Lets Check for GEdge and see if it is installed. If not, lets install it.
'*********************************************************************************
If strOS = "Microsoft Windows XP" Then
If Not RegKeyExists("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7EDD1CCA-F75D-4DB2-A958-B2E83C840EAF}") Then
wshShell.Run "xcopy ""\\server\deploy$\GEdge\GEdge Framework Client.msi"" C:\Install\GEdge\ /Y",0,True
wshShell.Run "xcopy ""\\server\deploy$\GEdge\GEdge Hard Disk Client.msi"" C:\Install\GEdge\ /Y",0,True
WshShell.Run "msiexec /i ""C:\Install\GEdge\GEdge Framework Client.msi"" /q REBOOT=ReallySuppress",0,True
WshShell.Run "msiexec /i ""C:\Install\GEdge\GEdge Hard Disk Client.msi"" /q REBOOT=ReallySuppress",0
Else
'**************************************************************************************************************
'Lets check if the version is current, if not lets upgrade - Version must be changed below in quotes. "9.5.0"
'**************************************************************************************************************
returnval= WSHShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\GE\Framework\ProductVersion")
If instr(returnval, "9.5.0") > 0 then
'---=== Version is recent, so lets do nothing. Have a great day!
Wscript.Quit
Else
'---=== Let's update this GEdge
wshShell.Run "xcopy ""\\server\deploy$\GuardianEdge\GuardianEdge Framework Client.msi"" C:\Install\GuardianEdge\ /Y",0,True
wshShell.Run "xcopy ""\\server\deploy$\GEdge\GEdge Hard Disk Client.msi"" C:\Install\GEdge\ /Y",0,True
WshShell.Run "msiexec /i ""C:\Install\GEdge\GEdge Framework Client.msi"" /q REINSTALL=ALL REINSTALLMODE=vomus REBOOT=ReallySuppress",0,True
WshShell.Run "msiexec /i ""C:\Install\GEdge\GEdge Hard Disk Client.msi"" /q REINSTALL=ALL REINSTALLMODE=vomus REBOOT=ReallySuppress",0
End if
End If
End If
End If
Set wshShell = Nothing
Set objWMIService = Nothing
Function RegKeyExists(strName)
Const NO_EXISTING_KEY = "HKEY_NO_EXISTING\Key\"
Dim objWsh
Dim strKeyPath
Dim strNoKeyError
Set objWsh = WScript.CreateObject("WScript.Shell")
strKeyPath = Trim(strName)
If Right(strKeyPath, 1) <> "\" Then strKeyPath = strKeyPath & "\"
On Error Resume Next
' Get the error description by trying to read a non-existent key
objWsh.RegRead NO_EXISTING_KEY
strNoKeyError = Err.Description
Err.Clear
objWsh.RegRead strKeyPath
' Compare the error description with the previous determined sample
If Replace(Err.Description, strKeyPath, _
NO_EXISTING_KEY) = strNoKeyError Then
RegKeyExists = False
Else
RegKeyExists = True
End If
Err.Clear
On Error Goto 0
Set objWsh = Nothing
End Function