Boston2012
Technical User
Any ideas on how I can add logic to this script to reboot:
Option Explicit
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
sComputer = "."
aTargetSvcs= Array("Symantec Antivirus","ccEvtMgr","SmcService","ccSetMgr")
Set oWMIService = GetObject("winmgmts:" & "{impersonationlevel=impersonate}!\\" _
& sComputer & "\root\cimv2")
Set cServices = oWMIService.ExecQuery("SELECT * FROM Win32_Service")
For Each oService In cServices
For Each sTargetSvc In aTargetSvcs
If LCase(oService.Name) = LCase(sTargetSvc) Then
If oService.State <> "Stopped" Then
oService.StopService()
End If
If oService.StartMode <> "Disabled" Then
oService.ChangeStartMode("Disabled")
End If
objShell.Run "C:\WINNT\system32\psshutdown.exe /R"
End If
Next
Next
Option Explicit
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
sComputer = "."
aTargetSvcs= Array("Symantec Antivirus","ccEvtMgr","SmcService","ccSetMgr")
Set oWMIService = GetObject("winmgmts:" & "{impersonationlevel=impersonate}!\\" _
& sComputer & "\root\cimv2")
Set cServices = oWMIService.ExecQuery("SELECT * FROM Win32_Service")
For Each oService In cServices
For Each sTargetSvc In aTargetSvcs
If LCase(oService.Name) = LCase(sTargetSvc) Then
If oService.State <> "Stopped" Then
oService.StopService()
End If
If oService.StartMode <> "Disabled" Then
oService.ChangeStartMode("Disabled")
End If
objShell.Run "C:\WINNT\system32\psshutdown.exe /R"
End If
Next
Next