blogs.conchango.com

welcome to the conchango blogging site
Welcome to blogs.conchango.com Sign in | Join | Help
in Search

Stuart Preston's Blog

Mostly about Visual Studio Team System, Team Foundation Server, Engineering Practices and Application Lifecycle Management.

Getting the account name for a given service using WMI, VBScript

More code that I've hacked together in VBScript to get the username used to start a particular service on my system:

Dim objWMIService, objService, strServiceStartName
Dim colListOfServices, strService

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery ("Select * from Win32_Service where name = 'MSSQLSERVER'")

For Each objService in colListOfServices
    strServiceStartName = Trim(objService.StartName)
Next

wscript.echo strServiceStartName

Published 14 November 2005 18:36 by Stuart.Preston

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server (Personal Edition), by Telligent Systems