Categories
SQL SQL Server Uncategorized

SSMS – Key not valid for use in specified state. (System.Security)

I got a new laptop and imported my SQL Server registrations from my old laptop. I exported the registrations with username and password credentials. But one of the imported server registrations had a problem which caused the error, “Key not valid for use in specified state.” each time I started SQL Server Management Studio.

To fix this error

  • Export the newly imported server registration, this will error with an error similiar to the following:
    Serialization operation on RegisteredServer[@Name=’dbServerName.development.local‘] has failed. (Microsoft.SqlServer.Management.Sdk.Sfc)
  • Open SSMS registered server configuration file:
    C:\Users\userName\AppData\Roaming\Microsoft\SQL Server Management Studio\RegSrvr##.xml
  • Remove all of the XML elements containing the registered server with the issue
    /RegisteredServersStore/ServerGroup/DatabaseEngineServerGroup/ServerGroup/Development/RegisteredServer/dbServerName.development.local