Reply to comment

Enumerating Windows Services

The Windows Services can be enumerated using Windows API EnumServicesStatus function or WMI Win32_Service class. The later is used in the code below.

loLocator 	= CREATEOBJECT('WBEMScripting.SWBEMLocator')
loWMI		= loLocator.ConnectServer() 
loWMI.Security_.ImpersonationLevel = 3  		&& Impersonate
 
loWinServices =  loWMI.ExecQuery("Select * from Win32_Service ")
 
FOR EACH loWinService IN loWinServices 
	WITH loWinService
		? .Name, .Displayname, .StartMode, .State, .Status
	ENDWITH	
ENDFOR

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <java>, <powershell>, <tsql>, <visualfoxpro>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.