How to Itemize NT Services
Keywords: NT services
Question:
Is there a way to itemize all services on a NT 4.0/2000 machines?Answer:
This information is stored in the registry on NT.This example for itemizing network services includes services such as EventLog, Schedule, and Spooler. These 3 don't have DisplayName values, but they are valid services.
This includes a check for a key that doesn't have a DisplayName, but does have an ObjectName. In this case, use the name of the key for the name of the service.
UNCServer=StrUpper(StrCat("\\"," Servername")) Server=RegConnect(UNCServer, @REGMACHINE) key=RegOpenkey(Server, "SYSTEM\CurrentControlSet\Services") svcs=RegQueryKeys(key) Count=ItemCount(svcs,@TAB) list="" For x = 1 to count dakey=ItemExtract(x,svcs,@TAB) if RegExistvalue(key,strcat(dakey,"[DisplayName]")) && RegExistvalue(key,strcat(dakey,"[Objectname]")) value=RegQueryValue(key,strcat("%dakey%","[DisplayName]")) list=strcat(list,@tab,value) endif if !RegExistvalue(key,strcat(dakey,"[DisplayName]")) && RegExistvalue(key,strcat(dakey,"[Objectname]")) value=dakey list=strcat(list,@tab,value) endif Next
Article ID: W13541Filename: Itemize Network Services.txt