WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Microsoft Client
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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:   W13541
Filename:   Itemize Network Services.txt
File Created: 2001:06:15:14:26:20
Last Updated: 2001:06:15:14:26:20