IADsServiceOperations Property Methods
Applies to: desktop apps only
The property methods of the IADsServiceOperations interface read and write the properties described in the following table. For more information about property methods, see Interface Property Methods.
Properties
- Status
-
- Status of service.
- The following are possible values.
- ADS_SERVICE_STOPPED (0x00000001)
- ADS_SERVICE_START_PENDING (0x00000002)
- ADS_SERVICE_STOP_PENDING (0x00000003)
- ADS_SERVICE_RUNNING (0x00000004)
- ADS_SERVICE_CONTINUE_PENDING (0x00000005)
- ADS_SERVICE_PAUSE_PENDING (0x00000006)
- ADS_SERVICE_PAUSED (0x00000007)
- ADS_SERVICE_ERROR (0x00000008)
- ADS_SERVICE_OWN_PROCESS (0x00000010)
- ADS_SERVICE_SHARE_PROCESS (0x00000020)
- ADS_SERVICE_KERNEL_DRIVER (0x00000001)
- ADS_SERVICE_FILE_SYSTEM_DRIVER (0x00000002)
- ADS_SERVICE_BOOT_START (SERVICE_BOOT_START)
- ADS_SERVICE_SYSTEM_START (SERVICE_SYSTEM_START)
- ADS_SERVICE_AUTO_START (SERVICE_AUTO_START)
- ADS_SERVICE_DEMAND_START (SERVICE_DEMAND_START)
- ADS_SERVICE_DISABLED (SERVICE_DISABLED)
- ADS_SERVICE_ERROR_IGNORE (0)
- ADS_SERVICE_ERROR_NORMAL (1)
- ADS_SERVICE_ERROR_SEVERE (2)
- ADS_SERVICE_ERROR_CRITICAL (3)
- Access type: Read-only
- Scripting data type: LONG
-
// C++ method syntax HRESULT get_Status( [out] LONG* pstatus );
Examples
The following code example shows how to verify the status of a Microsoft Fax Service running on Windows 2000.
Dim cp As IADsComputer Dim sr As IADsService Dim so As IADsServiceOperations On Error GoTo Cleanup Set cp = GetObject("WinNT://myMachine,computer") Set sr = cp.GetObject("Service", "Fax") Set so = sr Select Case so.Status Case ADS_SERVICE_STOPPED MsgBox "Microsoft Fax Service has stopped." Case ADS_SERVICE_RUNNING MsgBox "Microsoft Fax Service is running." Case ADS_SERVICE_PAUSED MsgBox "Microsoft Fax Service has paused." Case ADS_SERVICE_ERROR MsgBox "Microsoft Fax Service has errors." End Select Cleanup: If (Err.Number<>0) Then MsgBox("An error has occurred. " & Err.Number) End If Set cp = Nothing Set sr = Nothing Set so = Nothing
The following code example verifies the status of a Microsoft Fax Service running on Windows 2000.
IADsContainer *pCont = NULL; IADsServiceOperations *pSrvOp = NULL; LPWSTR adsPath = L"WinNT://myMachine,computer"; IDispatch *pDisp = NULL; long status = 0; HRESULT hr = S_OK; hr = ADsGetObject(adsPath,IID_IADsContainer,(void**)&pCont); if(FAILED(hr)) {goto Cleanup;} hr = pCont->GetObject(CComBSTR("Service"), CComBSTR("Fax"), &pDisp); if(FAILED(hr)) {goto Cleanup;} hr = pDisp->QueryInterface(IID_IADsServiceOperations,(void**)&pSrvOp); if(FAILED(hr)) {goto Cleanup;} hr = pSrvOp->get_Status(&status); switch (status) { case ADS_SERVICE_STOPPED: printf("The service has stopped.\n"); break; case ADS_SERVICE_RUNNING: printf("The service is running.\n"); break; case ADS_SERVICE_PAUSED: printf("The service has paused.\n"); break; case ADS_SERVICE_ERROR: printf("The service has errors.\n"); break; } Cleanup: if(pDisp) pDisp->Release(); if(pCont) pCont->Release(); if(pSrvOp) pSrvOp->Release();
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
|
DLL |
|
|
IID |
IID_IADsServiceOperations is defined as 5D7B33F0-31CA-11CF-A98A-00AA006BC149 |
See also
Send comments about this topic to Microsoft
Build date: 2/3/2012