# Test-ADRootDSE.ps1 try { $root = [ADSI]"LDAP://RootDSE" $defaultNC = [string]$root.defaultNamingContext Write-Host "OK: LDAP RootDSE bind worked" Write-Host "defaultNamingContext: $defaultNC" } catch { Write-Host "FAILED: Cannot bind to LDAP RootDSE" Write-Host "Reason: $($_.Exception.Message)" exit 1 }