Skip to content

Est. 2011ยทMicrosoft Partner ID 7033487ยทDelivery under 3 minยทSupport 7 days a week

Your vault is empty.

Free Fix 0x80090322

0x80090322 in the Exchange Management Shell: WinRM cannot authenticate

11 min read Updated October 5, 2026 Exchange Server

Fix it now

0x80090322 is SEC_E_WRONG_PRINCIPAL, “The target principal name is incorrect”. Microsoft’s documented cause for it over WinRM is the service principal name: the HTTP/<FQDN> entry PowerShell wants is already registered to another service account in the forest, or to a web service on the computer itself. Find that registration and the rest follows.

Elevated PowerShell. Substitute the fully qualified name of the server you are connecting to

setspn -q http/ex01.contoso.com
Test-WSMan ex01.contoso.com
klist purge
  1. Read the setspn -q output. If the HTTP SPN for that name is on a user or service account rather than on the computer account, you have found it.
  2. If the registration is obsolete, remove it from the account that should not hold it and reconnect after klist purge.
  3. If the account genuinely needs it, register a port-qualified SPN for WinRM instead: Setspn -s HTTP/ex01:5985 ex01 and Setspn -s HTTP/ex01.contoso.com:5985 ex01.
  4. Then connect with the port in the SPN: Enter-PSSession -ComputerName ex01.contoso.com -SessionOption (New-PSSessionOption -IncludePortInSPN).
  5. As a third documented option, point the WinRM client at the WSMAN prefix instead of HTTP, then register WSMAN SPNs on the computer account. The commands are in the reference table below.

Connect with the server’s real fully qualified name. Kerberos ties the ticket to the name you typed, so an alias, a CNAME or a load-balanced address fails here even when everything else is correct.

If a fresh shell now opens, you are done. If it does not, the next section separates the three layers that can produce this and tells you which one you are in.

Why it happens

Kerberos works by name. The client asks a domain controller for a ticket to a service principal name derived from the host name it was given, and the domain controller issues a ticket encrypted with the key of whichever account holds that SPN. The service then decrypts it with its own key. If the SPN sits on a different account from the one the service runs as, decryption fails and the client is told the target principal name is incorrect. That is SEC_E_WRONG_PRINCIPAL, 0x80090322, and Microsoft publishes the same wording for it in the Active Directory replication context, where it appears as the signed value -2146893022.

Microsoft’s article on this code over WinRM is specific about how it arises. PowerShell uses an HTTP service principal name in the form HTTP/<FQDN> to reach the remote server. The failure occurs when that SPN is already registered to another service account in the forest, or has been registered by hand against a web service running on the computer. The message the reader sees is “WinRM cannot process the request. The following error with error code 0x80090322 occurred while using Kerberos authentication: An unknown security error occurred”, which names neither the SPN nor the account.

The Exchange Management Shell is remote PowerShell over WinRM into the PowerShell virtual directory in IIS, even when you run it on the server console. That gives three layers that can break: the SPN registration in Active Directory, WinRM and its HTTP listener, and the authentication configuration on the virtual directory. HTTP 401.2 in the IIS log is the third one talking – published as “Logon failed due to server configuration”, which Microsoft describes as a problem in the authentication configuration settings on the server.

Work down that list in order and you will not waste a change window. Test-WSMan against the server’s FQDN separates the first two layers from the third: if it fails, Exchange is a bystander and the problem is WinRM or the SPN. If it succeeds and only the Exchange shell fails, you are looking at the PowerShell virtual directory.

The HTTP service principal name is on the wrong account

You have this one if setspn -q http/<FQDN> returns the SPN registered against a user or service account instead of the computer account.

  1. Decide whether that registration is still needed. Many are left over from an application that was decommissioned.
  2. If it is not needed, remove it from the account that holds it, then run klist purge on the client and reconnect.
  3. If it is needed, leave it alone and give WinRM its own port-qualified SPN: Setspn -s HTTP/ex01:5985 ex01 and Setspn -s HTTP/ex01.contoso.com:5985 ex01.
  4. Connect with Enter-PSSession -ComputerName ex01.contoso.com -SessionOption (New-PSSessionOption -IncludePortInSPN) so the client asks for the port-qualified name.

Some deployments deliberately hold HTTP SPNs on a service account so that Kerberos works to a load-balanced namespace. Check whether that is your design before deleting anything.

You want WinRM off the HTTP prefix entirely

You have this one if The HTTP SPN has to stay where it is, and adding a port-qualified SPN is not an option you want to carry.

  1. On the client, set the WSMAN prefix: reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN\Client /v spn_prefix /t REG_SZ /d "WSMAN" /f.
  2. Register the matching SPNs on the server’s computer account: Setspn -s WSMAN/ex01 ex01 and Setspn -s WSMAN/ex01.contoso.com ex01.
  3. Run klist purge and open a fresh session.
  4. Apply the client-side value everywhere management sessions originate, not only on the server console.

This is Microsoft’s third documented option, not a workaround someone invented. The value is REG_SZ, and it is a client-side setting.

You are connecting with a name Kerberos does not know

You have this one if The shell works against the server’s own FQDN and fails through an alias, a CNAME or a virtual IP.

  1. Use the server’s real FQDN for management sessions. Administrative connections do not need to travel through the client namespace.
  2. If an alias genuinely must work, register the matching SPN on the correct account rather than falling back to a weaker authentication scheme.
  3. Confirm forward and reverse DNS agree for the server, because a mismatch produces this intermittently and looks like flakiness.
  4. Run klist purge between attempts so you are not reading a cached ticket for the previous name.

WinRM or its IIS extension is missing

You have this one if Test-WSMan fails outright, or the WinRM IIS extension is absent after a rebuild or an image deployment.

  1. Check for the feature and install it if it is missing: Install-WindowsFeature WinRM-IIS-Ext.
  2. Re-establish the listener configuration with winrm quickconfig, then list what exists with winrm enumerate winrm/config/listener.
  3. Check nothing is intercepting the traffic: netsh winhttp show proxy should not be sending local names through a proxy.
  4. Restart the server if the feature installation asks for it, then retest with Test-WSMan.

The PowerShell virtual directory has lost its authentication configuration

You have this one if Test-WSMan succeeds, the SPN is right, and the IIS log for the PowerShell directory records 401.2 against your attempts.

  1. Compare the directory’s authentication settings against Microsoft’s published defaults for Exchange virtual directories. The front end and back end copies are configured differently on purpose, so do not set them from memory.
  2. Recreate rather than repair. From a working shell on another Exchange server, run Remove-PowerShellVirtualDirectory and then New-PowerShellVirtualDirectory against the broken server.
  3. Run iisreset /noforce on that server and retest with Test-PowerShellConnectivity.
  4. On a single-server organisation, load the Exchange management snap-in locally to get a shell long enough to run those two cmdlets.

This is the last resort, not the first. Microsoft’s documented cause for 0x80090322 is the SPN, and rebuilding a virtual directory to fix a Kerberos ticket problem simply loses you the directory’s settings as well.

Full reference

Narrowing it to one layer before you change anything

What you observe Which layer to work on
Test-WSMan also fails WinRM, its listener or the SPN. Exchange is not involved
Test-WSMan works, the Exchange shell fails The PowerShell virtual directory, or an SPN specific to the name you used
Works with the server FQDN, fails with an alias No SPN registered for the name you typed
setspn -q http/<FQDN> shows a user account The registration Microsoft names as the cause
HTTP 401.2 in the IIS log Authentication configuration on the virtual directory
It fails for one administrator only A stale ticket cache, or that account’s group membership

The three documented options, side by side

Option Commands When it fits
Remove the conflicting SPN setspn -q http/<FQDN> to find it, then remove it from the account that holds it The registration is obsolete
Give WinRM a port-qualified SPN Setspn -s HTTP/<server>:5985 <server> and Setspn -s HTTP/<FQDN>:5985 <server>, then connect with -IncludePortInSPN The HTTP SPN must stay where it is
Move the WinRM client to WSMAN spn_prefix REG_SZ set to WSMAN under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN\Client, then Setspn -s WSMAN/<server> <server> You want management traffic off the HTTP prefix altogether

Commands worth knowing

Command What it does
setspn -q http/<FQDN> Shows which account holds the HTTP SPN for that name. This is the query Microsoft’s article uses
setspn -L <computername> Lists every SPN on that computer account
klist purge Clears the current user’s Kerberos ticket cache
Test-WSMan <FQDN> Tests the WinRM layer on its own, without Exchange
winrm enumerate winrm/config/listener Shows which listeners exist and on which addresses
Test-PowerShellConnectivity Exchange’s own end-to-end test of the PowerShell virtual directory

iisreset drops every session the server is holding: browsers, mobile devices and Outlook connections all reconnect. Do it in a change window unless the server is already unusable.

The event that is not the cause

Event ID 15021 turns up in the System log on servers where a certificate has been replaced without rebinding an HTTPS endpoint, and it often appears in the same window as this failure. Microsoft publishes no description for it, so treat it as corroborating evidence rather than a diagnosis: it tells you the plumbing under IIS is worth a look, and it does not explain a Kerberos ticket that could not be decrypted. Do not fix a certificate binding and then assume you have fixed 0x80090322.

Managing Exchange from somewhere sensible

For day-to-day work, run the shell from a management workstation rather than the server console. It keeps you off the box, it means a broken PowerShell virtual directory on one server does not lock you out, and none of the fixes above change. Where it does matter is the SPN: a management workstation connects by the name you type, so register SPNs for the names your team actually uses rather than the one that happened to work first.

Every code this article covers

Code What it points at Source
0x80090322 SEC_E_WRONG_PRINCIPAL, “The target principal name is incorrect”. Over WinRM, Microsoft’s documented cause is an HTTP/<FQDN> SPN registered to another account Microsoft Learn
HTTP 401.2 Logon failed due to server configuration: a problem in the authentication configuration settings on the server Microsoft Learn
Event ID 15021 An HTTP.sys entry about the SSL configuration on an endpoint. Microsoft publishes no description, so read the event’s own text and treat it as context not published by the vendor

Confirm the fix worked

  1. setspn -q http/<FQDN> shows the HTTP SPN only where you intend it to be.
  2. Test-WSMan <FQDN> returns a normal identity response.
  3. A fresh Exchange Management Shell opens and Get-ExchangeServer runs without error.
  4. Test-PowerShellConnectivity -ClientAccessServer <server> succeeds.
  5. The IIS log for the PowerShell directory shows 200 for your requests rather than 401.

Questions people ask about this

Does fixing this cost anything?

No. It is a naming and configuration problem in Active Directory and IIS on servers you already license. Any advice about a wrong principal error that ends in a purchase should be treated with suspicion.

Why does it fail for one administrator and not another?

Usually a stale ticket cache, which klist purge clears. If it persists for one account, look at its group memberships: a very large Kerberos token can break authentication over HTTP where a smaller one works.

Can I use the admin centre while I fix the shell?

Often yes, and it is worth checking, because the web console uses a different virtual directory. If it also fails, the fault is something shared such as a certificate or a site-wide authentication change, and that widens the search usefully.

Is registering a port-qualified SPN safe?

Yes. It is one of the three options Microsoft documents for this error, and it exists precisely so WinRM can have its own registration without disturbing an HTTP SPN another service depends on. The client has to ask for it with -IncludePortInSPN.

Should I just recreate the PowerShell virtual directory?

Only after the SPN checks come back clean. Recreating it discards the directory’s settings and restarts IIS, and it cannot fix a Kerberos ticket that was issued for the wrong principal.

Related error codes

Was this article helpful?

Your feedback helps us improve our documentation.

Related articles

Free Fix 552 5.3.4: the message is larger than the Exchange size limit allows Free Fix 0x80070643 during an Exchange CU: setup fails and rolls the server back License Error 0x80090331 algorithm mismatch: legacy TLS blocks Exchange from Microsoft 365 License Error 535 5.7.139 authentication unsuccessful: SMTP AUTH submission failures
โ† Back to Knowledge Base