local loService loService = getServiceObject('Netrics Search Server') if not isnull(loService) loService.Delete() endif 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 loService