Jump to content

Are there facilities to retrieve Widows XP services?


 Share

Recommended Posts

No, the Process* functions are not suitable. One would need to know the actual name of the process or PID.

Basically, I just want to know if any functions exist currently to monitor and locate services in Windows XP? Before I redesign the wheel that is.

I've got a marvel idea, but it would be much nicer if I could simplify a few things.

Link to comment
Share on other sites

Show message box with all services:

_listservices()
Func _listservices()

$strComputer = "."
;$strComputer = @ComputerName
$objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2")

If $objWMIService = 0 Then
    MsgBox(0,"","WMI Connection Failure")
EndIf

$colListOfServices = $objWMIService.ExecQuery ("Select * from Win32_Service ")
$strServiceList = ""

For $objService in $colListOfServices
    $strServiceList &= $objService.name & @CRLF
Next

MsgBox(0,"",$strServiceList)
EndFunc
Link to comment
Share on other sites

I don't know exactl what you want.. but you could look at

http://www.autoitscript.com/forum/index.php?showtopic=29404

Emiel

Thanks for that link! Those UDFs look mighty nice. And basically, I just wanted to get a list of all internal service names so that I could pipe the list to a function.

Show message box with all services:

_listservices()
Func _listservices()

$strComputer = "."
;$strComputer = @ComputerName
$objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2")

If $objWMIService = 0 Then
    MsgBox(0,"","WMI Connection Failure")
EndIf

$colListOfServices = $objWMIService.ExecQuery ("Select * from Win32_Service ")
$strServiceList = ""

For $objService in $colListOfServices
    $strServiceList &= $objService.name & @CRLF
Next

MsgBox(0,"",$strServiceList)
EndFuncoÝ÷ Ûú®¢×Áë(æðyªhÛN§Í÷#¬iËnjYrv§Øb±«­¢+ØÀÌØíÁ¥ôIÕ¸¡
½µMÁµÀìÅÕ½Ðì½ÅÕ½ÐìµÀìÅÕ½ÐíÍÅÕÉäÍÑÑô±°ñ¥¹ÍÑÈÅÕ½ÐìÅÕ½ÐíMIY%
}95ÅÕ½ÐìÅÕ½ÐìÅÕ½Ðì°MåÍѵ¥È°M]}!%°ÀÌØíMQ=UQ}
!%1¤(ÀÌØí±ôQÉÕ)]¡¥±ÀÌØí±ôQÉÕ(ÀÌØí±¥¹ôMÑÉ¥¹IáÁIÁ±¡MѽÕÑI ÀÌØíÁ¥¤°ÅÕ½ÐíMIY%
}95èÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì¤(%ÉɽÈQ¡¸á¥Ñ1½½À(5Í ½à À°ÅÕ½ÐìÅÕ½Ðì°ÀÌØí±¥¹¤(ÀÌØí±ô±Í)]¹

More than one way to skin a cat I guess! :)

Link to comment
Share on other sites

The problem I have with COM objects and WMI is that I don't know the capabilities of it. I have no clue what functions are available without digging into google. With command line tools I have most of the documentation on my pc.

Link to comment
Share on other sites

The problem I have with COM objects and WMI is that I don't know the capabilities of it. I have no clue what functions are available without digging into google. With command line tools I have most of the documentation on my pc.

I'd have to agree. Windows scripting and the like is not familiar territory. I wasn't even aware I could poll WMI as a COM object until I saw you use it.

Which by the way, thanks... it opened up a whole new world. It's much easier to poll it then to use regular expressions to extract from SC queries.

And speaking of which:

%windir%\hh.exe ms-its:%windir%\Help\ntcmds.chm::/sc.htm

This tells me to click on the different SC commands available, but none are available... at least not on my machine.

Anyway, since you do have a particular knowledge of this, have you checked out Script-O-Matic and WMI Code Creator? Both are freely available from the Microsoft Web site.

Thanks again for your help. Your lead led me to *several* areas that have simplified my project.

Link to comment
Share on other sites

Link to comment
Share on other sites

ptrex, that would seem to be one solution. However, the problem is that its primary return is the process *not* the *service*.

Therefore, for example, one might get a list of svchost.exe's rather than the actual name of the services that invoke svchost.exe.

Another caveat is that it only reports on running processes (services).

I am not intimately familiar with its use, but a quick glance at its instructions and flags lead me to believe it is not idyllic in this situation.

Thanks for the feedback though! It is appreciated.

Edited by fowmow
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...