Platform SDK: Active Directory, ADSI, and Directory Services

IADsComputer Property Methods

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

Properties in Vtable Order

Property Description
ComputerID

[Visual Basic]
Access: Read
Data Type: BSTR

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

The globally unique identifier assigned to each machine.
Department

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_Department
([out] BSTR *pbstrDepartment);


HRESULT put_Department
([in] BSTR bstrDepartment);

The department (such as OU or organizational unit) within a company that this computer belongs to.
Description

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_Description
([out] BSTR *pbstrDescription);


HRESULT put_Description
([in] BSTR bstrDescription);

The description of this computer.
Division

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_Division
([out] BSTR *pbstrDivision);


HRESULT put_Division
([in] BSTR bstrDivision);

The division (such as organization) within a company that this computer belongs to.
Location

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_Location
([out] BSTR *pbstrLocation);


HRESULT put_Location
([in] BSTR bstrLocation);

The physical location of the machine where this machine is typically located.
MemorySize

[Visual Basic]
Access: Read/Write
Data Type: LONG

[C++]
HRESULT get_MemorySize
([out] LONG *plMemorySize);


HRESULT put_MemorySize
([in] LONG lMemorySize);

The size of random access memory (RAM) in megabytes (MB).
Model

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_Model
([out] BSTR *pbstrModel);


HRESULT put_Model
([in] BSTR bstrModel);

The make/model of this machine.
NetAddresses

[Visual Basic]
Access: Read/Write
Data Type: VARIANT

[C++]
HRESULT get_NetAddresses
([out] VARIANT *pvNetAddresses);


HRESULT put_NetAddresses
([in] VARIANT vNetAddresses);

An array of NetAddress fields that represent the addresses by which this computer can be reached. NetAddress is a provider-specific BSTR composed of two substrings separated by a colon (":"). The left-hand substring indicates the address type, and the right-hand substring is a string representation of an address of that type. For example, TCP/IP addresses are of the form "IP:100.201.301.45. IPX type addresses are of the form "IPX:10.123456.80".
OperatingSystem

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_OperatingSystem
([out] BSTR *pbstrOperatingSystem);


HRESULT put_OperatingSystem
([in] BSTR bstrOperatingSystem);

The name of the operating system used on this machine.
OperatingSystemVersion

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_OperatingSystemVersion
([out] BSTR *pbstrOperatingSystemVersion);


HRESULT put_OperatingSystemVersion
([in] BSTR bstrOperatingSystemVersion);

The operating system version number.
Owner

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_Owner
([out] BSTR *pbstrOwner);


HRESULT put_Owner
([in] BSTR bstrOwner);

The name of the person who typically uses this machine and has a license to run the installed software.
PrimaryUser

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_PrimaryUser
([out] BSTR *pbstrPrimaryUser);


HRESULT put_PrimaryUser
([in] BSTR bstrPrimaryUser);

The name of the contact person, in case something needs to be changed on this machine.
Processor

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_Processor
([out] BSTR *pbstrProcessor);


HRESULT put_Processor
([in] BSTR bstrProcessor);

The type of processor.
ProcessorCount

[Visual Basic]
Access: Read/Write
Data Type: LONG

[C++]
HRESULT get_ProcessorCount
([out] LONG *plProcessorCount);


HRESULT put_ProcessorCount
([in] LONG lProcessorCount);

The number of processors.
Role

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_Role
([out] BSTR *pbstrRole);


HRESULT put_Role
(
[in] BSTR bstrRole);

The role of this machine, for example, workstation, server, domain controller.
Site

[Visual Basic]
Access: Read
Data Type: BSTR

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

The globally unique identifier identifying the site this machine was installed in. A site represents a physical region of good connectivity in a network.
StorageCapacity

[Visual Basic]
Access: Read/Write
Data Type: LONG

[C++]
HRESULT get_StorageCapacity
([out] LONG *plStorageCapacity);


HRESULT put_StorageCapacity
([in] LONG lStorageCapacity);

The disk space in megabytes.

Remarks

Different providers may choose to expose different properties of a computer object. For more information, see ADSI System Providers.

You can discover what properties are supported by inspecting the mandatory and optional properties through its schema class. For more information, see the IADsClass interface.

To examine the status of a computer or to perform the shutdown operation across the network, you must use the IADsComputerOperations interface.

Example Code [Visual Basic]

The following Visual Basic code snippet examines computer properties supported by the ADSI WinNT provider.

Dim obj as IADs
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

Example Code [C++]

The following C++/C code snippet examines computer properties supported by the ADSI WinNT provider.

IADsComputer *pComp;
LPWSTR adspath = L"WinNT://kding1,computer";
HRESULT hr;

hr = ADsGetObject(adspath,IID_IADsComputer,(void**)&pComp);
if(FAILED(hr)) return hr;

BSTR bstr;
pComp->get_Owner(&bstr);
printf("Computer owner: %S\n",bstr);
SysFreeString(bstr);

pComp->get_OperatingSystem(&bstr);
printf("Operating System: %S\n",bstr);
SysFreeString(bstr);

pComp->Release();

See Also

Interface Property Methods, IADsComputerOperations, IADsClass