function getServiceObject(tcService) local lcService, loService, loLocator, loWMI if Vartype(tcService) # 'C' or Empty(tcService) return null endif lcService = Alltrim(tcService) try loLocator = createObject("wbemScripting.SwbemLocator") loWMI = loLocator.ConnectServer() loService = loWMI.Get("Win32_Service.Name='" + lcService + "'") catch loService = null endtry return loServiceNow we can do a small program to manage the service
local loService loService = getServiceObject('IISAdmin') if not isnull(loService) * Now we can send commands to it * for starting IIS: loService.StartService() * for stopping IIS loService.StopService() * for pausing IIS loService.PauseService() * and for resuming IIS loService.ResumeService() endif * Of course you will need to test the status and check for errors, but this is the basic code you need using WMI