Skip to content

Commit

Permalink
Fixed issue when checking objects from child and tree domain
Browse files Browse the repository at this point in the history
The main objects that we care about should be in the root of the forest which is where the Root Domain Naming Context should be set to. This should always work if the script is run in a domain joined computer.
  • Loading branch information
dpaulson45 committed Jul 23, 2021
1 parent 23a2f01 commit b7387fe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Setup/SetupAssist/Checks/Test-ValidHomeMdb.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

Function Test-ValidHomeMDB {
$filePath = "$PSScriptRoot\validHomeMdb.txt"
ldifde -t 3268 -r "(&(objectClass=user)(mailnickname=*)(!(msExchRemoteRecipientType=*))(!(targetAddress=*))(msExchHideFromAddressLists=TRUE)(!(cn=HealthMailbox*)))" -l "distinguishedName,homeMDB" -f $filePath | Out-Null
$rootDSE = [ADSI]("LDAP://RootDSE")
ldifde -t 3268 -r "(&(objectClass=user)(mailnickname=*)(!(msExchRemoteRecipientType=*))(!(targetAddress=*))(msExchHideFromAddressLists=TRUE)(!(cn=HealthMailbox*)))" `
-l "distinguishedName,homeMDB" -f $filePath -d $rootDSE.rootDomainNamingContext | Out-Null

$ldifeObject = @(Get-Content $filePath | ConvertFrom-Ldif)

if ($ldifeObject.Count -gt 0) {
Expand Down

0 comments on commit b7387fe

Please sign in to comment.