This function will take in a
-AccountName parameter and return an array of objects that list all currently set SPNs for a given remote computer.
If you’re expecting the output of
setspn -l domain\username, you must run the following:
Get-DbaSpn -AccountName domain\sqlserver | Where-Object SPN -like CORPSQL1 | Select SPN
This is because the Get-DbaSpn is intended to run on a large number of machines, so it does not target only the computer it is currently running on. We are working on a new feature that will make getting this output more straightforward.
Return a list of SPNs that have been set for a remote computer and all discovered instances of SQL Server
Get-DbaSpn -ComputerName sqlserverc
Use alternate Windows credentials to gather a list of SPNs that have been set for a remote computer and all discovered instances of SQL Server.
Get-DbaSpn -ComputerName sqlservera -Credential (Get-Credential)