The issue is that the passwords are stored in an encrypted string in the file, and the encryption key used is specific to that machine where SSMS is installed. So when you export them then import on a new machine, you get that error because it can't decrypt/use the passwords.
Most people just re-export from the old machine without passwords, then after importing into the new SSMS on the new machine, they manually go fix all the passwords.
What I wanted to add was that since it's "just a text file", you can save a LOT of work by manually editing C:\Users\{user}\AppData\Roaming\Microsoft\SQL Server Management Studio\RegSrvr.xml.
What I did was import the file and ignore all of those errors
===================================
Key not valid for use in specified state. (System.Security)
------------------------------ Program Location:
at System.Security.Cryptography.ProtectedData.Unprotect(Byte[]
encryptedData, Byte[] optionalEntropy, DataProtectionScope scope)
at
Microsoft.SqlServer.Management.RegisteredServers.RegisteredServer.ProtectData(String
input, Boolean encrypt) at
Microsoft.SqlServer.Management.RegisteredServers.RegisteredServer.get_SecureConnectionString()
at
Microsoft.SqlServer.Management.RegisteredServers.RegisteredServer.get_ConnectionString()
at
Microsoft.SqlServer.Management.RegisteredServers.RegisteredServer.get_ServerName()
at
Microsoft.SqlServer.Management.RegisteredServers.RegisteredServerTree.AddRegisteredServerNode(RegisteredServer
regSrv, TreeNodeCollection nodes)
Then I went through this process:
- In SSMS, fix a "server".
- Over in the file, copy/paste that "good" encrypted password string over to all of the other "servers" that had a connection using the same password.
- Restart SSMS.
- Repeat as needed.