Platform SDK: Active Directory, ADSI, and Directory Services |
The property methods of the IADsADSystemInfo interface get or set the properties described in the following table. For more information, see Interface Property Methods.
Property | Description |
---|---|
UserName
[Visual Basic] [C++] |
Name of the user account under which the system information is requested. |
ComputerName
[Visual Basic] [C++] |
Name of the host computer. |
SiteName
[Visual Basic] [C++] |
Name of the site. |
DomainShortName
[Visual Basic] [C++] |
Domain name in the short format, such as, "domainName". |
DomainDNSName
[Visual Basic] [C++] |
Domain name in the DNS format, such as, "domainName.companyName.com". |
ForestDNSName
[Visual Basic] [C++] |
Forest name in the DNS format, such as, "forestName.companyName.com". |
PDCRoleOwner
[Visual Basic] [C++] |
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] [C++] |
Schema master that performs schema updates. |
IsNativeMode
[Visual Basic] [C++] |
Whether the Active Directory™ domain is in native or mixed mode. |
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; }
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
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 %>