CFF KB - Carrz-Fox-Fire Promotions Knowledge Base

CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.
  • Breadrumbs:
  • SSMS Key not valid for use in specified state

  • CFF Knowledge Base - Share With Facebook CFF Knowledge Base - Share on Twitter CFF Knowledge Base - Share on Reddit CFF Knowledge Base - Share on Digg It CFF Knowledge Base - Share on Stumble Upon It CFF Knowledge Base - Share on Delicious
    Share With Friends (Updated 6-8-2010)
  • Article ID:
    3238
  • Date Created
    Wednesday, January 12, 2022
  • Last Updated
    Sunday, April 30, 2023
  • This Article Has been Viewed
    603 times
  • Short Desc
    SQL Server Management Studio gives an error Key not valid for use in specified state.
  • Details
    Loading SQL Server Management Studio on a system with the RegSrvr.xml file from a previous installation can cause the error "Key not valid for use in specified state" when trying to read from an encrypted password in the XML file.
  • Recreate Issue
    In the RegSrvr.xml, you will have the following entries for every server you have attached to SQL Server Management Studio or SSMS.
    ConnectionStringWithEncryptedPassword
    These are the encrypted passwords for your SQL Server Instances attached to SSMS.
  • Resolve Issue
    This article describes two methods of doing the same thing.
    Option #1 was added on 4/30/2023 in correspondence with a video that will soon be uploaded to our YouTube channel. (Link will be posted shortly.)
    Option #1 is the quicker way of performing this action.
    Some changes have also been made to the original instructions as well.)

    There are two locations the RegSrvr.xml file will be.

    Option #1

    Location #1:
    C:\Users\{user}\AppData\Roaming\Microsoft\SQL Server Management Studio\RegSrvr.xml

    Open the file in Notepad or Notepad++ or another.
    Perform a search and remove the lined sections with the worded phrase, [ConnectionStringWithEncryptedPassword] from location #1 above.

    (Do not edit the copy in location #2 as it is a template for location #1)

    Location #2:
    C:\Users\{user}\AppData\Roaming\Microsoft\Microsoft SQL Server\140\Tools\Shell\RegSrvr.xml

    ---------------------------
    Option #2 (Quicker and without the file editing.)
    Close SSMS
    In Location #1, change the name of the file.
    Leave the file in Location #2, as it is a template for the file in Location #1.
    Load SSMS again after changing the #1 file, and a new file will be created.
    Choose [View]
    Then choose [Registered Servers]
    Expand [Database Engine]
    Then Expand [Local Server Groups]
    Next, Right-click on each of the Servers and select [Properties]
    When the Dialog opens, type in the Username and Password.
    Next, click on [Test]
    If it is a good connection, you will receive the following message.

     

    Edit Server Registration Properties
    ------------------------------
    The connection was tested successfully.
    ------------------------------


    After receiving the above message, click the check box beside [Remember password].
    Then click [Save]

    Perform the above on each Registered Server until you have completed your list.
    At the moment, there is no other workaround.
    I read and tested what one person on Stack Exchange stated by taking a new password and copying that password, and paste it in place of the old passwords that are the same.
    This is FALSE. I tested it and received the same error as this KB Article describes.