|
-
Aug 23rd, 2003, 03:56 PM
#1
get all the services
How can I get all of the services on someone's computer? I know they are listed in the registry, so how exactly could I get the name of all of them, not knowing what they may be, and put them into an array or list or anything else so I can display, sort and do other things?
-
Aug 24th, 2003, 12:56 AM
#2
Frenzied Member
Add the system.ServiceProcess.dll to the references, and use servicecontroller class to enumerate all the services on a machine.
The code assumes that you have a listbox added to your form.
VB Code:
Imports System.SerivceProcess
'
'
'
Dim servctrl() As ServiceController
servctrl = System.ServiceProcess.ServiceController.GetServices(Machine_name_can_go_here)
For Each serv As ServiceController In servctrl
ListBox1.Items.Add(serv.ServiceName)
Next
Last edited by Lunatic3; Aug 24th, 2003 at 09:59 AM.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Aug 24th, 2003, 10:25 AM
#3
How do I get the machine name?
-
Aug 24th, 2003, 10:42 AM
#4
Frenzied Member
If it is a local computer then you may leave it blank, if it is in a domain then you may apply other methods to get the computer name. By the way this task needs adminsitrative privilege.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|