The target principal name is incorrect. Cannot generate SSPI context.
The point of this post is so I don't forget how to solve this in the future.
Every once in a while I receive the error message: "The target principal name is incorrect. Cannot generate SSPI context." when trying to connect to a SQL Server instance on another machine on the network (same domain). Every time I get this message I can't remember how to fix it (usually because I tried dozens of things and don't know which one actually worked). This time, however, I only tried two... and one (or both) of them worked!
So, future self, this will (probably) fix this:
- Make sure you aren't connected to a VPN (or make sure you are connected, if needed). Test to see if it works, if it works, stop here. :-)
- Make sure IPV6 is disabled (no idea why).
- Remote in to your server as the Admin.
- Go to Administrative Tools -> Active Directory Users and Computers.
- Computers -> {Your Computer}: Right Click -> Refresh.
- Users -> {You}: Right Click -> Properties -> Account: Check "Unlock account" -> Apply.
To those of you who are not me, I'm sorry these instructions are crap, but hopefully it'll give you an idea of what to try.