If you ever have the need to add multiple UPN or SPN suffixes to your forest here is a simple script which will do it in no time. Just add the suffixes to a text file, one per line works the best :).
For UPN Suffixes
1 2 3 4 5 6 7 8 9 10 11 12 13 |
$domains = Get-Content -Path C:\UPNList.txt $forest = Get-ADForest $currentUPN = $forest.UPNSuffixes foreach ($domain in $domains) { if($currentUPN.Contains($domain) -eq $true){ echo "Already exist: $domain" }else{ echo "Adding UPN: $domain" Set-ADForest -Identity $forest.Name -UPNSuffixes @{Add=$domain} } } |
For SPN Suffixes
1 2 3 4 5 6 7 8 9 10 11 12 13 |
$domains = Get-Content -Path C:\SPNList.txt $forest = Get-ADForest $currentSPN = $forest.SPNSuffixes foreach ($domain in $domains) { if($currentSPN.Contains($domain) -eq $true){ echo "Already exist: $domain" }else{ echo "Adding SPN: $domain" Set-ADForest -Identity $forest.Name -SPNSuffixes @{Add=$domain} } } |