Directory Services

IADsService Property Methods

The property methods of the IADsService interface read and write the properties described in this topic. For more information, see Interface Property Methods.

Properties

Property Description
Dependencies

[Visual Basic]
Access: Read/Write
DataType: Variant

[C++]
HRESULT get_Dependencies
([out] VARIANT* pvServiceDepend);
HRESULT put_Dependencies
([in] VARIANT vServiceDepend);

Array of BSTR names of services or load groups that must be loaded in order for this service to load. The syntax for the entry is "Service:" followed by the service name or "Group:" followed by the load group name.
DisplayName

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_DisplayName
([out] BSTR* pbstrDisplayName);
HRESULT put_DisplayName
([in] BSTR bstrDisplayName);

The friendly name of the service.
ErrorControl

[Visual Basic]
Access: Read/Write
DataType: Long

[C++]
HRESULT get_ErrorControl
([out] LONG* plErrorControl);
HRESULT put_ErrorControl
([in] LONG lErrorControl);

The action to be performed if this service fails on startup. The following are valid values for this property.
Value Meaning
ADS_SERVICE_ERROR_IGNORE The startup program logs the error, but continues the startup operation.
ADS_SERVICE_ERROR_NORMAL The startup program logs the error and puts up a message box pop-up, but continues the startup operation.
ADS_SERVICE_ERROR_SEVERE The startup program logs the error. If the last-known-good configuration is being started, the startup operation continues. Otherwise, the system is restarted with the last-known-good configuration.
ADS_SERVICE_ERROR_CRITICAL The startup program logs the error, if possible. If the last-known-good configuration is being started, the startup operation fails. Otherwise, the system is restarted with the last-known good configuration.
HostComputer

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_HostComputer
([out] BSTR* pbstrHostComputer);
HRESULT put_HostComputer
([in] BSTR bstrHostComputer);

The ADsPath string of the host of this service.
LoadOrderGroup

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_LoadOrderGroup
([out] BSTR* pbstrLoadOrderGroup);
HRESULT put_LoadOrderGroup
([in] BSTR bstrLoadOrderGroup);

Name of the load order group that this service is a member of.
Path

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_Path
([out] BSTR* pbstrPath);
HRESULT put_Path
([in] BSTR bstrPath);

Path and filename to the executable of this service.
ServiceAccountName

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_ServiceAccountName
([out] BSTR* pbstrServiceAccountName);
HRESULT put_ServiceAccountName
([in] BSTR bstrServiceAccountName);

Name of the account that this service uses to authenticate itself on startup.
ServiceAccountPath

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_ServiceAccountPath
([out] BSTR* pbstrServiceAccountPath);
HRESULT put_ServiceAccountPath
([in] BSTR bstrServiceAccountPath);

Path of the account specified by the ServiceAccountPath property.
ServiceType

[Visual Basic]
Access: Read/Write
DataType: Long

[C++]
HRESULT get_ServiceType
([out] LONG* plServiceType);
HRESULT put_ServiceType
([in] LONG lServiceType);

The description of how a service manifests itself on the host computer. This property can be zero or a combinaiton of one or more of the following values.
Name Value
ADS_SERVICE_KERNEL_DRIVER 0x00000001
ADS_SERVICE_FILE_SYSTEM_DRIVER 0x00000002
ADS_SERVICE_OWN_PROCESS 0x00000010
ADS_SERVICE_SHARE_PROCESS 0x00000020
StartType

[Visual Basic]
Access: Read/Write
DataType: Long

[C++]
HRESULT get_StartType
([out] LONG* plStartType);
HRESULT put_StartType
([in] LONG lStartType);

Determines how the service should be started. The following are valid values for this property.
Value Meaning
ADS_SERVICE_BOOT_START The service is a device driver started by the system loader. This value is valid only for driver services.
ADS_SERVICE_SYSTEM_START The service is a device driver started by the IoInitSystem function. This value is valid only for driver services.
ADS_SERVICE_AUTO_START The service will be started automatically by the service control manager during system startup.
ADS_SERVICE_DEMAND_START The service will be started by the service control manager when a process calls the StartService function.
ADS_SERVICE_DISABLED The service cannot be started. Attempts to start the service result in the error code ERROR_SERVICE_DISABLED.
StartupParameters

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_StartupParameters
([out] BSTR* pbstrStartupParameters);
HRESULT put_StartupParameters
([in] BSTR bstrStartupParameters);

Parameters passed to the service at startup.
Version

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_Version
([out] BSTR* pbstrVersion);
HRESULT put_Version
([in] BSTR bstrVersion);

Version of the service.

Example Code [Visual Basic]

The following code example shows how to list all the available system services running on the host computer, "myMachine", together with the location to find the executables of the services.

Dim cp As IADsComputer
On Error GoTo Cleanup

Set cp = GetObject("WinNT://myMachine,computer")
If (IsEmpty(cp) = False) Then
	cp.Filter = Array("Service")
	For Each service In cp
		MsgBox service.Name & " @" & service.path
	Next
End if

Cleanup:
	If (Err.Number<>0) Then
		MsgBox("An error has occurred. " & Err.Number)
	End If
	Set cp = Nothing

Requirements

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Iads.h.

See Also

IADsService, Interface Property Methods