Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to add logic to reboot

Status
Not open for further replies.

Boston2012

Technical User
Nov 8, 2012
17
US
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
 
Hopefully this thread lasts long enough this time for you to read this...

You asked the same question here, and I gave you an answer. So, what have you tried and where are you stuck?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top