# DNS Alias Info
$DNSAlias = Get-Content C:\temp\nas.txt
# AD Server Information
$ADObjects = Get-ADComputer -Filter * -SearchBase "OU=TESTServer,DC=test,DC=local" -Property Name,ServicePrincipalName | Select-Object name,@{Name="SPN";e={$_.ServicePrincipalName -join ","}}
# Check Server SPN entry contains DNS Alias
foreach ($DNS in $DNSAlias){
foreach ($ADObj in $ADObjects){
If ($ADObj -like "*$DNS*"){
$log = "$DNS Object found in $ADObj" | Out-File -Append C:\temp\Result.txt
}else{
$Log = "$Dns Object Not Found in $ADObj" | Out-File -Append C:\temp\Result-Not.txt
}
}
}
$DNSAlias = Get-Content C:\temp\nas.txt
# AD Server Information
$ADObjects = Get-ADComputer -Filter * -SearchBase "OU=TESTServer,DC=test,DC=local" -Property Name,ServicePrincipalName | Select-Object name,@{Name="SPN";e={$_.ServicePrincipalName -join ","}}
# Check Server SPN entry contains DNS Alias
foreach ($DNS in $DNSAlias){
foreach ($ADObj in $ADObjects){
If ($ADObj -like "*$DNS*"){
$log = "$DNS Object found in $ADObj" | Out-File -Append C:\temp\Result.txt
}else{
$Log = "$Dns Object Not Found in $ADObj" | Out-File -Append C:\temp\Result-Not.txt
}
}
}
No comments:
Post a Comment