Platform SDK: Active Directory, ADSI, and Directory Services

IADsADSystemInfo Property Methods

The property methods of the IADsADSystemInfo interface get or set the properties described in the following table. For more information, see Interface Property Methods.

Properties in Vtable Order

Property Description
UserName

[Visual Basic]
Access: Read
Data Type: BSTR

[C++]
HRESULT get_UserName
(
[out] BSTR *pbstrUser);

Name of the user account under which the system information is requested.
ComputerName

[Visual Basic]
Access: Read
Data Type: BSTR

[C++]
HRESULT get_ComputerName
(
[out] BSTR *pbstrComputer);

Name of the host computer.
SiteName

[Visual Basic]
Access: Read
Data Type: BSTR

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

Name of the site.
DomainShortName

[Visual Basic]
Access: Read
Data Type: BSTR

[C++]
HRESULT get_DomainShortName
(
[out] BSTR *pbstrDSN);

Domain name in the short format, such as, "domainName".
DomainDNSName

[Visual Basic]
Access: Read
Data Type: BSTR

[C++]
HRESULT get_DomainDNSName
(
[out] BSTR *pbstr);

Domain name in the DNS format, such as, "domainName.companyName.com".
ForestDNSName

[Visual Basic]
Access: Read
Data Type: BSTR

[C++]
HRESULT get_ForestDNSName
(
[out] BSTR *pbstr);

Forest name in the DNS format, such as, "forestName.companyName.com".
PDCRoleOwner

[Visual Basic]
Access: Read
Data Type: BSTR

[C++]
HRESULT get_PDCRoleOwner
(
[out] BSTR *pbstr);

The domain name of a directory service agent (DSA) object playing the role of the primary domain controller for computers running Windows NT® 4.0.
SchemaRoleOwner

[Visual Basic]
Access: Read
Data Type: BSTR

[C++]
HRESULT get_SchemaRoleOwner
(
[out] BSTR *pbstr);

Schema master that performs schema updates.
IsNativeMode

[Visual Basic]
Access: Read
Data Type: VARIANT_BOOL

[C++]
HRESULT get_IsNativeMode
(
[out] VARIANT BOOL *pvBool);

Whether the Active Directory™ domain is in native or mixed mode.

Example Code [C++]

The following C++ code snippet retrieves the Windows® 2000 system information. For brevity, error checking is omitted.

#include <activeds.h>
#include <stdio.h>
 
int main()
{
   HRESULT hr;
 
   hr = CoInitialize(NULL);
 
    IADsWinNTSystemInfo *pSys;
    hr = CoCreateInstance(CLSID_ADSystemInfo,
                          NULL,
                          CLSCTX_INPROC_SERVER,
                          IID_IADsADSystemInfo,
                          (void**)&pSys);
 
   BSTR bstr;
   hr = pSys->get_UserName(&bstr);
   if (SUCCEEDED(hr)) {
      printf("User: %S\n", bstr);
      SysFreeString(bstr);
   }
 
   hr = pSys->get_ComputerName(&bstr);
   if (SUCCEEDED(hr)) {
      printf("Computer: %S\n", bstr);
      SysFreeString(bstr);
   }
 
   hr = pSys->get_DomainDNSName(&bstr);
   if (SUCCEEDED(hr)) {
      printf("Domain: %S\n", bstr);
      SysFreeString(bstr);
   }
 
   hr = pSys->get_PDCRoleOwner(&bstr);
   if (SUCCEEDED(hr)) {
      printf("PDC Role owner: %S\n", bstr);
      SysFreeString(bstr);
   }
 
   if(pSys) {
      pSys->Release();
   }
 
   CoUninitialize();
   return 0;
}

Example Code [Visual Basic]

The following Visual Basic® code snippet retrieves the Windows 2000 system information.

Dim sys As New ADSystemInfo
Debug.print "User: " & sys.UserName
Debug.print "Computer: " & sys.ComputerName
Debug.print "Domain: " & sys.DomainDNSName
Debug.print "PDC Role Owner: " & sys.PDCRoleOwner

Example Code [VBScript]

The following VBScript/ASP code snippet retrieves the Windows 2000 system information.

<%
Dim sys
Set sys = CreateObject("ADSystemInfo")
Repsonse.Write "User: " & sys.UserName
Repsonse.Write "Computer: " & sys.ComputerName
Repsonse.Write "Domain: " & sys.DomainDNSName
Repsonse.Write "PDC Role Owner: " & sys.PDCRoleOwner
%>

See Also

IADsADSystemInfo, CoCreateInstance