SSOGEN / Free tools / setspn Command Builder and SPN Checker, Free in Your Browser
Free tool
setspn Command Builder and SPN Checker, Free in Your Browser
setspn is the Windows command that reads and changes the service principal names (SPNs) on an Active Directory account. This free tool validates an SPN, checks pasted setspn output for duplicates and missing name pairs, and builds the commands, in your browser.
Check an SPN, read setspn output, build commands
Enter an SPN, paste setspn output, or build a command. To see sample output, use the Acme samples.
1. Check one SPN
Format: serviceclass/host[:port][/servicename]. For example HTTP/intranet.acme.example.
2. Check pasted setspn output
Paste the whole output. The checker looks for the same SPN on more than one account, short names without their fully qualified partner, and entries that look unusual.
3. Build the setspn commands
Private by design. Everything happens in this page and nothing is sent anywhere. The tool never connects to your domain: it reads the text you give it and writes commands for you to run yourself. Pasted output holds account and host names, so use a copy you are allowed to look at.
Free, in your browser. There is no sign-up and no limit. The tool never connects to your domain, makes no network request and reads only the text you give it.
You run the commands it writes, with your own rights, in your own domain.
The tool has three parts:
- Part 1 explains the components of one SPN.
- Part 2 reads the output you paste from setspn. It flags the same SPN on two accounts, short names with no fully qualified partner, and malformed entries.
- Part 3 builds the commands:
-S,-A,-D,-L,-Qand-X.
Each switch gets a line on what it does, plus the PowerShell equivalent for a user account.
What an SPN is
setspn. The command-line tool that lists, adds and deletes service principal names (SPNs) on an Active Directory account.
SPN. The name Kerberos uses to find the account that runs a service.
First check. When web single sign-on falls back to a password prompt, rule out a missing or duplicated SPN first.
This tool. This free tool checks an SPN’s format, reads pasted setspn -L, -Q or -X output for problems, and writes the commands for you to run.
What an SPN looks like
Microsoft gives the format as serviceclass/host:port/servicename. Only the first two parts are required (Name formats for unique SPNs, Microsoft Learn, read 2026-10-09).
| Part | Required | What it is | Acme example |
|---|---|---|---|
| Service class | Yes | The general class of service, such as HTTP or ldap. It cannot contain a forward slash. |
HTTP |
| Host | Yes | The computer the service runs on, as a fully qualified DNS name or a NetBIOS name. | intranet.acme.example |
| Port | No | Tells apart several instances of one service class on a host. Leave it out for the default port. | :8080 |
| Service name | No | Used for replicable services, such as a database. A web site normally has none. | /reports |
Everything else on this page follows from two rules (Service principal names, read 2026-10-09):
- Unique in the forest. An SPN must be unique in the forest where it is registered. Microsoft says authentication fails if it is not.
- One account. A given SPN can be registered on only one account.
On case, the setspn page says SPNs are not case sensitive on Windows-based computers.
Many other systems, UNIX-based ones especially, are case sensitive and need the proper case.
The pair most web sites need
A client builds the SPN from the name it was given:
http://intranet/in the address bar requestsHTTP/intranet.http://intranet.acme.example/, the fully qualified form, requestsHTTP/intranet.acme.example.
These are two different names. If both are in use, register both.
Microsoft’s name-format page says the same about replicable services: if clients will use the NetBIOS name to compose the SPN, each replica must also register an SPN containing the NetBIOS name.
The checker applies that rule to every entry.
A short name with no fully qualified partner gets a warning, because a browser using the long name will not find it.
A fully qualified name with no short partner gets a note, which matters only if users type the short name.
| What the checker sees | What it tells you |
|---|---|
| The same SPN on two accounts | A real fault. Delete it from the account that should not hold it, then run -X again. |
HTTP/intranet only |
Browsers using intranet.acme.example have no matching SPN. Add the long name. |
HTTP/intranet.acme.example only |
Fine unless people type the short name. |
| An IP address as the host | Microsoft names a DNS name or a NetBIOS name as the host. Replace it. |
| A service class outside Microsoft’s built-in list | Normal for an application’s own class. Check it against the application’s documentation. |
HOST/ on a computer account |
Microsoft says a host SPN can stand in for the built-in classes, http among them, unless they are placed on objects explicitly. |
The setspn switches
These come from the setspn reference (Microsoft Learn, read 2026-10-09). Run setspn from an elevated command prompt on a computer with the Active Directory Domain Services role tools.
| Switch | What it does |
|---|---|
-S |
Adds the SPN after verifying that no duplicates exist. |
-A |
The older add. It does not check for duplicates, which is why Microsoft says to use -S instead. |
-D |
Deletes the SPN from the account. |
-L |
Lists the SPNs registered for the account. |
-R |
Resets the default SPN registrations for a computer. |
-Q |
Queries for existing SPNs. |
-X |
Searches for duplicate SPNs. |
-C / -U |
Says the account is a computer or a user account. They are mutually exclusive. With neither, setspn takes the name as a computer if one exists, and as a user if it does not. |
-F |
Runs queries against the forest instead of the domain. |
-T |
Names the domain to query, or the forest with -F. It can be repeated. |
-P |
Suppresses progress output, for redirecting to a file or an unattended script. No output shows until the command finishes. |
Five examples follow the pattern the same page uses, with this tool’s Acme names. The second removes an SPN; the last finds every SPN for one name across a forest:
setspn -U -S HTTP/intranet.acme.example ACME\svc-intranetsetspn -D HTTP/intranet.acme.example ACME\svc-intranetsetspn -L ACME\svc-intranetsetspn -T * -T acme.example -Xsetspn -T acme.example -F -Q */intranetMicrosoft also notes that SPNs must be built on the base name of the account you give; otherwise the directory returns a constraint violation error.
You may lack the right to change this property on some accounts.
The page says you can check the rights in Active Directory Users and Computers, and that the “Validated write to service principal name” permission can be delegated to a user or group.
PowerShell for a user account
The Active Directory module does the same job on a user object.
Set-ADUser. Its-ServicePrincipalNamesparameter takes a hashtable withAdd,RemoveorReplace.- LDAP name. Its documentation gives the LDAP name of the property as
servicePrincipalName.
Get-ADUser returns a default set of properties. For an attribute outside the default and extended sets, pass the LDAP display name to -Properties.
Get-ADUser -Identity svc-intranet -Properties servicePrincipalName | Select-Object -ExpandProperty servicePrincipalNameSet-ADUser -Identity svc-intranet -ServicePrincipalNames @{Add="HTTP/intranet.acme.example"}Sources: the Set-ADUser and Get-ADUser pages, Microsoft Learn, read 2026-10-09.
Neither cmdlet is documented with a duplicate check, so run setspn -Q or -X first, or use setspn -S, which is built for it.
Why a duplicate SPN breaks Kerberos sign-in
When a client asks the domain controller for a ticket to HTTP/intranet.acme.example, the domain controller looks the name up and encrypts the ticket with the key of the one account that holds it.
Two failures follow when the directory does not match that expectation.
-
The name is on two accounts. Microsoft’s troubleshooting guide lists
KDC_ERR_PRINCIPAL_NOT_UNIQUEfor an SPN tied to more than one account. For one tied to none it lists the server-principal-not-found error (KDC_ERR_S_PRINCIPAL_…). The Windows event decoder shows both as Kerberos result codes 0x8 and 0x7 on event 4768. -
The ticket is made for one account and read by another.
KRB_AP_ERR_MODIFIEDmeans the client could not decrypt the service ticket. Microsoft says more than one issue can cause it, and names two: out-of-sync clocks and an SPN that is not unique.
In a multi-domain environment, the service account name might not be unique in the forest.
The event text in Microsoft’s older article says the password used to encrypt the ticket differs from the one on the target server.
Users see either a password prompt or a sign-in that works but is not single sign-on. Microsoft’s single sign-on guide says SSO problems usually mean the client used a protocol other than Kerberos when it should have used Kerberos.
Its IIS checklist keeps Negotiate first and NTLM second in the provider list.
With that order, a failed Kerberos exchange can still end in a successful NTLM sign-in, so a site that “works” does not prove Kerberos is in use.
Paste the client’s klist output into the klist reader to see whether a service ticket for the SPN was ever issued.
Getting web Kerberos SSO to work
Four conditions must hold, and the SPN is only one of them. Microsoft’s Kerberos authentication troubleshooting guidance and its guide to troubleshooting Kerberos single sign-on issues (both read 2026-10-09) cover them.
- The right service class on the right account. A web site uses
HTTP. Register it on the account the web server’s service runs as: a domain service account if the application pool or service signs in with one, or the computer account if it runs as a built-in identity. A computer account with aHOSTSPN already covershttpunless it is placed explicitly elsewhere. AddingHTTP/to a second account for the same name is how duplicates start. - The exact host name. The ticket is issued for the name the browser used. An alias, a CNAME or an IP address in the address bar asks for a different SPN, or none. Microsoft’s guide says to check the Edge
AuthServerAllowlistpolicy, which should list the fully qualified names of the target servers. It also says Edge treats only the Internet and Local intranet zones. - A client that sends Kerberos. The site must offer Negotiate. Microsoft’s IIS baseline is Windows Authentication on and Anonymous Authentication off.
- Sound infrastructure. This means clocks within five minutes of the domain controller, DNS that resolves the target name, and open ports to the domain controller. Microsoft says the client and the target service must not be on the same computer, or Kerberos is off by default.
A computer account is the machine’s identity; a service account is one you create for the service.
Either way, the SPN sits on the account the service signs in with. Microsoft says that when a service instance’s sign-in account changes, you must register the SPNs again under the new account.
Where this fits with SSOGEN
Kerberos in SSOGEN. The sign-in method described on the Kerberos authentication page: a user on a domain-joined computer opens My Apps or a protected application without a password.
Setup guide. The Windows desktop sign-in guide has the exact setup. It lists a name registered on two accounts among the reasons a Windows sign-in can be refused.
Ticket flow. For the flow behind it, read Kerberos SSO for web applications and what Kerberos is.
Failures. If a domain controller logs a failure, paste it into the Windows event decoder.
Questions about setspn
What is setspn used for?
What does setspn -S do compared with setspn -A?
How do I find a duplicate SPN?
How do I remove an SPN with setspn?
setspn -D HTTP/intranet.acme.example ACME\svc-intranet, from an elevated command prompt. Then run setspn -L on the account to confirm it is gone. You need the right to change the account’s SPN property.How do I set an SPN for a service account?
setspn -U -S HTTP/intranet.acme.example ACME\svc-intranet. The -S switch checks for duplicates before it adds the name. Use -U for a user account, -C for a computer account.How do I find my UPN? It is not an SPN.
name@domain. At a Windows command prompt, whoami /upn prints the signed-in user’s name in UPN format (Microsoft Learn’s whoami reference, read 2026-10-09).Is an SPN case sensitive?
Do I need both HTTP/intranet and HTTP/intranet.acme.example?
Which account should hold the HTTP SPN?
Is it safe to paste setspn output into this page?
Where to go next
- Free tools. Browse the other free tools.
- NTLM fallback. To see whether a fallback to NTLM happened, paste the event into the event ID 4776 decoder.
Sources, all Microsoft Learn and read 2026-10-09: setspn, Service principal names and Name formats for unique SPNs. Also cited in the text without links: Kerberos authentication troubleshooting guidance, Troubleshooting Kerberos single sign-on issues, KRB_AP_ERR_MODIFIED, Set-ADUser, Get-ADUser and whoami. Microsoft and Windows are trademarks of their owner; SSOGEN is not affiliated with Microsoft.