PowerShell – How-To Retrieve SPN’s for all Servers

Yet another short one with little context or reason.

A colleague of mine needed a list of all Service Principal Names assigned to all servers on the estate. Searches online brought us to a few potential solutions, most of which included the use of some difficult to use and understand .NET classes which appeared to be limited to only 1000 results.

So that got me thinking, these are just Active Directory attributes so why not use PowerShells very own Get-ADComputer?

The script below will list every single server in Active Directory and all assigned SPN’s, it will then export the list to a CSV.

Continue reading “PowerShell – How-To Retrieve SPN’s for all Servers”