diff --git a/scripts/Deploy-AuthBroker.ps1 b/scripts/Deploy-AuthBroker.ps1 index 9a2d762..6e590af 100644 --- a/scripts/Deploy-AuthBroker.ps1 +++ b/scripts/Deploy-AuthBroker.ps1 @@ -140,7 +140,12 @@ foreach ($definition in $roleGroupDefinitions) { throw "$($definition.Role)GroupDn must identify a security group beneath BaseDn." } - $roleGroup = Get-ADGroup -Identity $definition.Dn -Server $LdapHost -ErrorAction SilentlyContinue + try { + $roleGroup = Get-ADGroup -Identity $definition.Dn -Server $LdapHost -ErrorAction Stop + } + catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException] { + $roleGroup = $null + } if (-not $roleGroup -and $CreateMissingOus) { $groupDnMatch = [regex]::Match($definition.Dn, '^CN=(?[^,]+),(?.+)$', [Text.RegularExpressions.RegexOptions]::IgnoreCase) if (-not $groupDnMatch.Success) {