commands

^

Get-DbaSpn

Author Drew Furgiuele (@pittfurg), port1433.com
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Get-DbaSpn on GitHub.
Want to see the Bill Of Health for this command? Check out Get-DbaSpn.

Synopsis

Returns a list of set service principal names for a given computer/AD account

Description

Get a list of set SPNs. SPNs are set at the AD account level. You can either retrieve set SPNs for a computer, or any SPNs set for
a given active directory account. You can query one, or both. You'll get a list of every SPN found for either search term.

Syntax

Get-DbaSpn
    [[-ComputerName] <String[]>]
    [[-AccountName] <String[]>]
    [[-Credential] <PSCredential>]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbaSpn -ComputerName SQLSERVERA -Credential ad\sqldba

Returns a custom object with SearchTerm (ServerName) and the SPNs that were found

Example: 2
PS C:\> Get-DbaSpn -AccountName domain\account -Credential ad\sqldba

Returns a custom object with SearchTerm (domain account) and the SPNs that were found

Example: 3
PS C:\> Get-DbaSpn -ComputerName SQLSERVERA,SQLSERVERB -Credential ad\sqldba

Returns a custom object with SearchTerm (ServerName) and the SPNs that were found for multiple computers

Optional Parameters

-ComputerName

The servers you want to return set SPNs for. This is defaulted automatically to localhost.

Alias
Required False
Pipeline true (ByValue)
Default Value
-AccountName

The accounts you want to retrieve set SPNs for.

Alias
Required False
Pipeline false
Default Value
-Credential

User credential to connect to the remote servers or active directory.

Alias
Required False
Pipeline false
Default Value
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False