The following script is provided as an example, if any assistance or customization is required with this script, our Professional Service team should be able to assist with it.
$PolicyObjectDN = "
CN=Policy Name,CN=Administration,CN=Policies,CN=Configuration"
- DN of a directory object to which you want to apply the PO
$ObjectToApplyDN = "
OU=Sales,DC=mycompany,DC=com"
$APLinksContainerDN = "CN=AP Links,CN=Configuration"
$APLinkType = "edsPolicyObjectLink"
- Construct a unique Policy Object link name
$APLinkName = [Guid]::NewGuid().ToString()Connect-QADService -Proxy
$PolicyObject = Get-QADObject $PolicyObjectDN -DontUseDefaultIncludedProperties
$APOGUID = $PolicyObject.Guid.ToByteArray()
$ObjectToApply = Get-QADObject $ObjectToApplyDN -DontUseDefaultIncludedProperties
$SecObjectGUID = $ObjectToApply.Guid.ToByteArray()
- Create policy object link object
New-QADObject -Proxy -ParentContainer $APLinksContainerDN -Name $APLinkName -Type $APLinkType -ObjectAttributes @{"edsaAPOGUID"=$APOGUID;"edsaSecObjectGUID"=$SecObjectGUID}