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
-
ComputerName
-
-
Access type: Read-only
-
Scripting data type: BSTR
-
// C++ method syntax HRESULT get_ComputerName( [out] BSTR* pbstrComputer );
Retrieves the distinguished name of the local computer.
-
-
DomainDNSName
-
-
Access type: Read-only
-
Scripting data type: BSTR
-
// C++ method syntax HRESULT get_DomainDNSName( [out] BSTR* pbstr );
Retrieves the DNS name of the local computer's domain, such as "domainName.companyName.com".
-
-
DomainShortName
-
-
Access type: Read-only
-
Scripting data type: BSTR
-
// C++ method syntax HRESULT get_DomainShortName( [out] BSTR* pbstrDSN );
Retrieves the short name of the local computer's domain, such as "domainName".
-
-
ForestDNSName
-
-
Access type: Read-only
-
Scripting data type: BSTR
-
// C++ method syntax HRESULT get_ForestDNSName( [out] BSTR* pbstr );
Retrieves the DNS name of the local computer's forest.
-
-
IsNativeMode
-
-
Access type: Read-only
-
Scripting data type: BOOL
-
// C++ method syntax HRESULT get_IsNativeMode( [out] BOOL* pvBool );
Determines whether the local computer's domain is in native or mixed mode.
-
-
PDCRoleOwner
-
-
Access type: Read-only
-
Scripting data type: BSTR
-
// C++ method syntax HRESULT get_PDCRoleOwner( [out] BSTR* pbstr );
Retrieves the distinguished name of the directory service agent (DSA) object for the DC that owns the primary domain controller role in the local computer's domain.
-
-
SchemaRoleOwner
-
-
Access type: Read-only
-
Scripting data type: BSTR
-
// C++ method syntax HRESULT get_SchemaRoleOwner( [out] BSTR* pbstr );
Retrieves the distinguished name of the directory service agent (DSA) object for the DC that owns the schema master role in the local computer's forest.
-
-
SiteName
-
-
Access type: Read-only
-
Scripting data type: BSTR
-
// C++ method syntax HRESULT get_SiteName( [out] BSTR* pbstrSite );
Retrieves the site name of the local computer.
-
-
UserName
-
-
Access type: Read-only
-
Scripting data type: BSTR
-
// C++ method syntax HRESULT get_UserName( [out] BSTR* pbstrUser );
Retrieves the Active Directory distinguished name of the current user, which is the logged-on user or the user impersonated by the calling thread.
-
Examples
The following C++ code example retrieves the Windows system information. For brevity, error checking is omitted.
#include <activeds.h>
#include <stdio.h>
int main()
{
HRESULT hr;
hr = CoInitialize(NULL);
IADsADSystemInfo *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 example retrieves the Windows 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 example retrieves the Windows system information.
<%
Dim sys
Set sys = CreateObject("ADSystemInfo")
Response.Write "User: " & sys.UserName
Response.Write "Computer: " & sys.ComputerName
Response.Write "Domain: " & sys.DomainDNSName
Response.Write "PDC Role Owner: " & sys.PDCRoleOwner
%>
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows Vista |
Minimum supported server |
Windows Server 2008 |
Header |
|
DLL |
|
IID |
IID_IADsADSystemInfo is defined as 5BB11929-AFD1-11D2-9CB9-0000F87A369E |