Hi all,
Need help with a script. I have a script that is uninstalling trend micros and then installing mcafee. The install leaves up two cmd prompts and as it installs the cmd prompts go away. The second command prompt goes away after about 30 minutes or so. Need a way to track when it completes so I can prompt the user that the script is complete and then write the machine name to a file that it has completed. Here is the code below
ON ERROR RESUME NEXT
Dim file
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FilesystemObject")
set objShell = Wscript.CreateObject("WScript.Shell")
'VPN Check
If objFSO.FolderExists("Some Folder") then
objshell.Popup "YOU ARE CURRENTLY ON VPN/SMITH AND NEPHEW NETWORK." & vbCrLf & "PRESS OK TO CONTINUE.", 60, "IT INFORMATION UPDATE", vbOKOnly
Else
objShell.Popup "UNABLE TO LAUNCH SCRIPT" & vbCrLf & "YOU ARE NOT ON THE VPN/SMITH AND NEPHEW NETWORK." & vbCrLf & VbCrLf & "PLEASE GET ON IT REMOTE ACCESS(FULL) AND RUN THE ATTACHMENT AGAIN.", 60, "IT INFORMATION
UPDATE", vbOKOnly
Wscript.Quit
End If
Set file = CreateObject("Scripting.FilesystemObject")
file.DeleteFile("C:\Programdata\Microsoft\Windows\Start Menu\Programs\Startup\Message.vbs")
'GPUpdate
WshShell.Run "%comspec% /c gpupdate /force"
WScript.Sleep(90000)
'Uninstall Trend Micro
If objFSO.FileExists("C:\Program Files (x86)\Microsoft Office\Office14\Winword.exe") Then
WshShell.Run """C:\Program Files (x86)\Trend Micro\OfficeScan Client\ntrmv.exe"" -980223" ,0,True
ElseIf objFSO.FileExists("C:\Program Files\Microsoft Office\Office14\Winword.exe") Then
WshShell.Run """C:\Program Files\Trend Micro\OfficeScan Client\ntrmv.exe"" -980223" ,0,True
Else WScript.Echo "having trouble"
End If
'Install McAfee
If objFSO.FileExists("C:\Program Files (x86)\Microsoft Office\Office14\Winword.exe") Then
WshShell.Run "%comspec% /c E: & cd ""\McAfee\Agent\v4.5.0.1852\"" & cscript Appsetup(x64).vbs"
WshShell.Run "%comspec% /c E: & cd ""\McAfee\VSE&ASE\v8.8 with Patch1\"" & cscript Appsetup(x64).vbs"
ElseIf objFSO.FileExists("C:\Program Files\Microsoft Office\Office14\Winword.exe") Then
WshShell.Run "%comspec% /c E: & cd ""\McAfee\Agent\v4.5.0.1852\"" & cscript Appsetup(x86).vbs"
WshShell.Run "%comspec% /c E: & cd ""\McAfee\VSE&ASE\v8.8 with Patch1\"" & cscript Appsetup(x86).vbs"
Else WScript.Echo "Trouble Installing McAfee! Please call SNBio IT at and select Option 2 for support."
WScript.Quit
End If
WScript.Quit
Christopher