Last active
February 14, 2025 17:18
-
-
Save tcartwright/0934d5fe9a86af3a09fe6b4ac0b4c2e4 to your computer and use it in GitHub Desktop.
POWERSHELL: Test SPNs and AD connectivity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Clear-Host | |
Write-Host "`r`nSetspn -L `$env:COMPUTERNAME`r`n" -ForegroundColor Yellow | |
Setspn -L $env:COMPUTERNAME | |
Write-Host "`r`nSetspn -L `"`$(`$env:USERDOMAIN)\`$(`$env:USERNAME)`"`r`n" -ForegroundColor Yellow | |
Setspn -L "$($env:USERDOMAIN)\$($env:USERNAME)" | |
Write-Host "`r`nTest-ComputerSecureChannel`r`n" -ForegroundColor Yellow | |
Test-ComputerSecureChannel | |
Write-Host "`r`nTest-NetConnection (`$env:LOGONSERVER -replace `"\\`", `"`")" -ForegroundColor Yellow | |
Test-NetConnection ($env:LOGONSERVER -replace "\\", "") | |
Write-Host "`r`n[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain();" -ForegroundColor Yellow | |
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain(); | |
Write-Host "`r`nGet-ADComputer -Filter * | Select-Object -First 5 | Format-Table -Property Name, DNSHostName" -ForegroundColor Yellow | |
Get-ADComputer -Filter * | Select-Object -First 5 | Format-Table -Property Name, DNSHostName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment