大网数据广告活动
域与目录服务

IADsService Property Methods (Iads.h)

· 52CE 我爱测

Read and write the properties described in this topic.

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

Properties

Dependencies

Array of BSTR names of services or load groups that must be loaded 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.

Access type: Read/write

Scripting data type: VARIANT

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

DisplayName

The friendly name of the service.

Access type: Read/write

Scripting data type: BSTR

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

ErrorControl

The action to be performed if this service fails on startup. The following are valid values for this property.

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 presents a message box, but continues the startup operation.

ADS_SERVICE_ERROR_SEVERE

The startup program logs the error. If the last-known-good configuration is 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.

Access type: Read/write

Scripting data type: LONG

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

HostComputer

The ADsPath string of the host of this service.

Access type: Read/write

Scripting data type: BSTR

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

LoadOrderGroup

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

Access type: Read/write

Scripting data type: BSTR

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

Path

Path and filename to the executable of this service.

Access type: Read/write

Scripting data type: BSTR

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

ServiceAccountName

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

Access type: Read/write

Scripting data type: BSTR

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

ServiceAccountPath

Path of the account specified by the ServiceAccountPath property.

Access type: Read/write

Scripting data type: BSTR

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

ServiceType

The description of how a service presents itself on the host computer. This property can be zero or a combination of one or more of the following values.

ADS_SERVICE_KERNEL_DRIVER (0x00000001)

ADS_SERVICE_FILE_SYSTEM_DRIVER (0x00000002)

ADS_SERVICE_OWN_PROCESS (0x00000010)

ADS_SERVICE_SHARE_PROCESS (0x00000020)

Access type: Read/write

Scripting data type: LONG

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

StartType

Determines how to start the service. The following are valid values for this property.

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.

Access type: Read/write

Scripting data type: LONG

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

StartupParameters

Parameters passed to the service at startup.

Access type: Read/write

Scripting data type: BSTR

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

Version

Version of the service.

Access type: Read/write

Scripting data type: BSTR

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

Examples

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

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Header Iads.h
DLL Activeds.dll
IID IID_IADsService is defined as 68AF66E0-31CA-11CF-A98A-00AA006BC149

See also

IADsService

Interface Property Methods

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。