IADsComputer 屬性方法

IADsComputer介面方法可讀取和寫入本主題中所述的屬性。 如需詳細資訊,請參閱 介面屬性方法

屬性

ComputerID

指派給每部電腦的全域唯一識別碼。

存取類型:唯讀

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_ComputerID(
  [out] BSTR* pbstrComputerID
);

部門

組織單位 (OU) ,例如此電腦所屬的部門。

存取類型:讀取/寫入

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_Department(
  [out] BSTR* pbstrDepartment
);
HRESULT put_Department(
  [in] BSTR bstrDepartment
);

說明

這部電腦的描述。

存取類型:讀取/寫入

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_Description(
  [out] BSTR* pbstrDescription
);
HRESULT put_Description(
  [in] BSTR bstrDescription
);

部門

此電腦所屬組織的部門。

存取類型:讀取/寫入

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_Division(
  [out] BSTR* pbstrDivision
);
HRESULT put_Division(
  [in] BSTR bstrDivision
);

位置

此電腦指派的實體位置。

存取類型:讀取/寫入

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_Location(
  [out] BSTR* pbstrLocation
);
HRESULT put_Location(
  [in] BSTR bstrLocation
);

MemorySize

此電腦隨機存取記憶體的大小,以 MB 為單位。

存取類型:讀取/寫入

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_MemorySize(
  [out] BSTR* pbstrMemorySize
);
HRESULT put_MemorySize(
  [in] BSTR bstrMemorySize
);

型號

這部電腦的製作和模型。

存取類型:讀取/寫入

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_Model(
  [out] BSTR* pbstrModel
);
HRESULT put_Model(
  [in] BSTR bstrModel
);

NetAddresses

NetAddress 欄位的陣列,代表可觸達這部電腦的位址。 NetAddress 是由由冒號 (:) 分隔的兩個子字串所組成的提供者特定 BSTR 。 左子字串表示網址類別型,右邊的子字串是該類型位址的字串表示。 例如,TCP/IP 位址的格式如下:IP:100.201.301.45。 IPX 類型位址的格式如下:IPX:10.123456.80。

存取類型:讀取/寫入

腳本資料類型: VARIANT

// C++ method syntax
HRESULT get_NetAddresses(
  [out] VARIANT* pvNetAddresses
);
HRESULT put_NetAddresses(
  [in] VARIANT vNetAddresses
);

OperatingSystem

此電腦上所使用的作業系統。

存取類型:讀取/寫入

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_OperatingSystem(
  [out] BSTR* pbstrOperatingSystem
);
HRESULT put_OperatingSystem(
  [in] BSTR bstrOperatingSystem
);

OperatingSystemVersion

此電腦上所使用的作業系統版本。

存取類型:讀取/寫入

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_OperatingSystemVersion(
  [out] BSTR* pbstrOperatingSystemVersion
);
HRESULT put_OperatingSystemVersion(
  [in] BSTR bstrOperatingSystemVersion
);

擁有者

指派此電腦的人員。 此人也應該擁有執行已安裝軟體的授權。

存取類型:讀取/寫入

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_Owner(
  [out] BSTR* pbstrOwner
);
HRESULT put_Owner(
  [in] BSTR bstrOwner
);

PrimaryUser

此電腦的連絡人名稱,例如系統管理員。

存取類型:讀取/寫入

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_PrimaryUser(
  [out] BSTR* pbstrPrimaryUser
);
HRESULT put_PrimaryUser(
  [in] BSTR bstrPrimaryUser
);

處理器

處理器類型。

存取類型:讀取/寫入

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_Processor(
  [out] BSTR* pbstrProcessor
);
HRESULT put_Processor(
  [in] BSTR bstrProcessor
);

ProcessorCount

已安裝的處理器數目。

存取類型:讀取/寫入

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_ProcessorCount(
  [out] BSTR* pbstrProcessorCount
);
HRESULT put_ProcessorCount(
  [in] BSTR bstrProcessorCount
);

角色

此電腦的角色,例如工作站、伺服器或網域控制站。

存取類型:讀取/寫入

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_Role(
  [out] BSTR* pbstrRole
);
HRESULT put_Role(
  [in] BSTR bstrRole
);

站台

全域唯一識別碼,可識別此電腦安裝所在的月臺。 月臺是網路中良好連線的實體區域。

存取類型:唯讀

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_Site(
  [out] BSTR* pbstrSite
);

StorageCapacity

磁片的大小,以 MB 為單位。

存取類型:讀取/寫入

腳本資料類型: BSTR

// C++ method syntax
HRESULT get_StorageCapacity(
  [out] BSTR* pbstrStorageCapacity
);
HRESULT put_StorageCapacity(
  [in] BSTR bstrStorageCapacity
);

備註

不同的提供者可以選擇公開電腦物件的不同屬性。 如需詳細資訊,請參閱 ADSI 系統提供者

您可以透過其架構類別檢查強制和選擇性屬性,以探索支援哪些屬性。 如需詳細資訊,請參閱 IADsClass 介面。

若要檢查電腦的狀態,或要跨網路執行關機作業,您必須使用 IADsComputerOperations 介面。

範例

下列 Visual Basic 程式碼範例會檢查 ADSI WinNT 提供者所支援的電腦屬性。

Dim obj As IADs
On Error Resume Next

Set obj = GetObject("WinNT://myMachine,computer")
If (obj.Class = "Computer") Then
    MsgBox "Computer owner: " & obj.owner
    MsgBox "Computer division: " & obj.Division
    MsgBox "Computer operatingSystem: " & obj.OperatingSystem
    MsgBox "Computer operating System Version: " & obj.OperatingSystemVersion
    MsgBox "Computer processor: " & obj.Processor
    MsgBox "Computer processor Count: " & obj.ProcessorCount
End If

下列 C++ 程式碼範例會檢查 ADSI WinNT 提供者支援的電腦屬性。

IADsComputer *pComp = NULL;
LPWSTR adspath = L"WinNT://jeffsmith1,computer";
HRESULT hr = S_OK;
BSTR bstr = NULL;

hr = ADsGetObject(adspath,IID_IADsComputer,(void**)&pComp);
if(FAILED(hr)) {goto Cleanup;}

hr = pComp->get_Owner(&bstr);
if(FAILED(hr)) {goto Cleanup;}

printf("Computer owner: %S\n",bstr);
SysFreeString(bstr);

hr = pComp->get_OperatingSystem(&bstr);
if(FAILED(hr)) {goto Cleanup;}
printf("Operating System: %S\n",bstr);
SysFreeString(bstr);

Cleanup:
    if(pComp) pComp->Release();
    if(bstr) SysFreeString(bstr);
    return hr;

規格需求

需求
最低支援的用戶端
Windows Vista
最低支援的伺服器
Windows Server 2008
標頭
Iads.h
DLL
Activeds.dll
IID
IID_IADsComputer定義為 EFE3CC70-1D9F-11CF-B1F3-02608C9E7553

另請參閱

IADsComputer

ADSI 系統提供者

IADsClass

IADsComputerOperations

Interface 屬性方法