The IADsService interface is a dual interface that inherits from IADs. It is designed to maintain data about system services running on a host computer. Examples of such services include "FAX" for Microsoft Fax Service, "RemoteAccess" for Routing and RemoteAccess Service, and "seclogon" for Secondary Logon Service. Examples of the data about any system service include the path to the executable file on the host computer, the type of the service, other services or load group required to run a particular service, and others. IADsService exposes several properties to represent such data.
The IADsService interface has these methods.
The system services are published in the underlying directory. Some may be running, others may not. To verify the status or to operate on any of the services, use the properties and methods of the IADsServiceOperations interface.
To identify services available on a host computer, first bind to the computer and then enumerate the services available on that computer. The following code example shows how to do this.
Public Sub ListServicesOnComputer(ComputerName As String) Dim comp As IADsComputer Dim srvc As IADsServiceOperations On Error GoTo Cleanup Set comp = GetObject("WinNT://" + ComputerName + ",Computer") comp.Filter = Array("Service") For Each srvc In comp ' The srvc object is an IADsServiceOperations object that can be ' used to obtain the status of the service with the Status property. ' Other IADs properties can also be obtained. Next Cleanup: If (Err.Number <> 0) Then MsgBox (Err.Description & vbLf & vbLf & " Error number = " & Err.Number) End If Set comp = Nothing End Sub
|Windows version||Windows Vista Windows Server 2008|