Submitted By: Randy Mullins
Starts or stops the PC Anywhere service. Just enter server name and start or stop.
dim svcName, sStart, sStop dim service dim objService dim SvrName dim input input = Inputbox ("Server Name that you would like to Start or Stop PCAnywhere service on:", "Stop or start pcanywhere service") SvrName = input svcName = "awhost32" Set service = GetObject("winmgmts:!\\" & svrName & "\root\cimv2") svc = "Win32_Service=" & "'" & svcName & "'" state = inputbox("Enter start or stop to Change the Status of PCAnywhere Service, (need to use lowercase)") if state = "start" then Set objService = Service.Get(svc) retVal = objService.StartService() elseif state = "stop" then Set objService = Service.Get(svc) retVal = objService.StopService() end if
dim svcName, sStart, sStop dim service dim objService dim SvrName dim input input = Inputbox ("Server Name that you would like to Start or Stop PCAnywhere service on:", "Stop or start pcanywhere service") SvrName = input svcName = "awhost32" Set service = GetObject("winmgmts:!\\" & svrName & "\root\cimv2") svc = "Win32_Service=" & "'" & svcName & "'" state = inputbox("Enter start or stop to Change the Status of PCAnywhere Service, (need to use lowercase)") if state = "start" then Set objService = Service.Get(svc) retVal = objService.StartService() elseif state = "stop" then Set objService = Service.Get(svc) retVal = objService.StopService() end if