Functions

src/CustomActions/ActiveDirectory/DirectoryServices.cpp File Reference

#include "StdAfx.h"
#include "DirectoryServices.h"
#include "FlagMaps.h"

Functions

CA_API UINT __stdcall DirectoryGetDcName (MSIHANDLE hInstall)
 The DsGetDcName function returns the name of a domain controller in a specified domain.

Function Documentation

CA_API UINT __stdcall DirectoryGetDcName ( MSIHANDLE  hInstall)

The DsGetDcName function returns the name of a domain controller in a specified domain.

The DsGetDcName function returns the name of a domain controller in a specified domain. This function accepts additional domain controller selection criteria to indicate preference for a domain controller with particular characteristics.

Parameters:
DS_COMPUTERNAMEOptional string that specifies the name of the server to process this function.
DS_DOMAINNAMEOptional string that specifies the name of the domain or application partition to query.
DS_SITENAMEOptional string that specifies the name of the site where the returned domain controller should physically exist.
DS_FLAGSContains a set of flags that provide additional data used to process the request.
Returns:
DS_DOMAINCONTROLLER_NAME Specifies the computer name of the discovered domain controller, stripped from heading backslashes.
DS_DOMAINCONTROLLER_ADDRESS Specifies the address of the discovered domain controller, stripped from heading backslashes.
DS_DOMAIN_NAME Specifies the name of the domain.

See http://msdn.microsoft.com/en-us/library/ms675912(VS.85).aspx for details about flags and parameters.

Example:
<Binary Id="ActiveDirectory" SourceFile="$(var.BinDir)\ActiveDirectory.dll" />
<CustomAction Id="SetDSFlags" Property="DS_FLAGS" Value="DS_IP_REQUIRED|DS_ONLY_LDAP_NEEDED|DS_RETURN_DNS_NAME" />
<CustomAction Id="FindActiveDirectory" BinaryKey="ActiveDirectory" DllEntry="DirectoryGetDcName" Execute="immediate" Return="check" />
<CustomAction Id="SetActiveDirectoryProperty" Property="ACTIVE_DIRECTORY_SERVER_DISPLAYED" Value="[DS_DOMAINCONTROLLER_NAME]" />
<InstallUISequence>
 <Custom Action="SetDSFlags" After="CostInitialize">1</Custom>
 <Custom Action="FindActiveDirectory" After="SetDSFlags">1</Custom>
 <Custom Action="SetActiveDirectoryProperty" After="FindActiveDirectory">1</Custom>
</InstallUISequence>

Todo:
implement domain guid, get DS_DOMAINGUID and convert
Todo:
support other return values



© Application Security Inc. - All Rights Reserved http://msiext.codeplex.com