1. Need to delete registry entry for Sophos if exist
2. Run setup.exe and monitor the process still it get closed by it self
3.Delete again registry entry for Symantec that required restart.
4. Run again same Setup
in below script its run till step 2 and jump to step 4 and run setup again, it does not wait for setup 1 and 2 complete.
--------------------------------------------------------------------------------------------------
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg=GetObject("winmgmts:"_
& "{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
KeyPath = "Software\Sophos\AutoUpdate\UpdateStatus\VolatileFlags"
'Delete new key
Return = objReg.DeleteKey(HKEY_LOCAL_MACHINE, KeyPath)
If (Return = 0) And (Err.Number = 0) Then
' Wscript.Echo _
' "HKEY_LOCAL_MACHINE\Software\Sophos\AutoUpdate\UpdateStatus\VolatileFlags" & _
' " successfully deleted"
'Else
' Wscript.Echo "DeleteKey failed. Error = " & Err.Number
End If
Dim WshShell
Set WshShell = WScript.CreateObject("Wscript.Shell")
WScript.Sleep 3000
WshShell.Run ("Setup.exe")
Do
WScript.Sleep 3000
Loop Until Setup1 = False
WScript.Sleep 3000
Do
WScript.Sleep 3000
Loop Until SEPsetup1 = False
WScript.Sleep 5000
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Symantec_Installer"
oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
WScript.Sleep 5000
'Dim WshShell
Set WshShell = WScript.CreateObject("Wscript.Shell")
WshShell.Run ("Setup.exe")
Do
WScript.Sleep 3000
Loop Until Setup2 = False
WScript.Sleep 3000
Do
WScript.Sleep 3000
Loop Until SEPsetup2 = False
Function Setup1 'This function is to verify process
set service = GetObject ("winmgmts:")
for each Process in Service.InstancesOf ("Win32_Process")
If Process.Name = "Setup.exe" then
Flag = True
Exit For
End If
Next
If Flag Then
FindWusa = True
Else
FindWusa = False
End If
End Function
Function SEPsetup1
set service = GetObject ("winmgmts:")
for each Process in Service.InstancesOf ("Win32_Process")
If Process.Name = "SEPsetup.exe" then
Flag = True
Exit For
End If
Next
If Flag Then
FindWusa = True
Else
FindWusa = False
End If
End Function
Function Setup2
set service = GetObject ("winmgmts:")
for each Process in Service.InstancesOf ("Win32_Process")
If Process.Name = "Setup.exe" then
Flag = True
Exit For
End If
Next
If Flag Then
FindWusa = True
Else
FindWusa = False
End If
End Function
Function SEPsetup2
set service = GetObject ("winmgmts:")
for each Process in Service.InstancesOf ("Win32_Process")
If Process.Name = "SEPsetup.exe" then
Flag = True
Exit For
End If
Next
If Flag Then
FindWusa = True
Else
FindWusa = False
End If
End Function
If (Return = 0) And (Err.Number = 0) Then
Wscript.Echo Err.Description & Err.Number
End If
Support@Mytechnet.me