get-windowsfeature : The given key was not present in the dictionary

When you run the get-windowsfeature cmdlet in PowerShell on Windows Server 2012 you may see the following error

get-windowsfeature : The given key was not present in the dictionary.

At line:1 char:1
+ get-windowsfeature
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-WindowsFeature], KeyNotFoundException
    + FullyQualifiedErrorId : System.Collections.Generic.KeyNotFoundException,Microsoft.Windows.ServerManager.Commands
   .GetWindowsFeatureCommand

This seems to occur if there is a problem in the following registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerManager\ServicingStorage\ServerComponentCache

As this is just a cache registry key you can try renaming the key to ServerComponentCache.old and then re-running the PowerShell command or refreshing the view in server manager.

This recreates the key and rebuilds the server feature information.


- While you're here -
Why not check out our Windows Server Documentation and Audit Tool?


Comments

  1. Thank you very much. I tried this and it fixed my issue. Amazing!

    ReplyDelete
  2. Thank you very much man!!.This solved my issue

    ReplyDelete
  3. Thank you solved my issue

    ReplyDelete
  4. Ace - this is going in my personal list of useful tips that REALLY fix issues..

    ReplyDelete
  5. Thank you. I don't think I would ever have found this particular one.

    ReplyDelete
    Replies
    1. No problems, feel free to check out our network documentation tool :)

      https://www.centrel-solutions.com/xiaconfiguration/network-documentation-tool.aspx?referrer=dblogad

      Delete
  6. It works! Brilliant, thank you.

    ReplyDelete
  7. It helped me as well, thank you!

    ReplyDelete
  8. Such a simple fix to repair a big mess. Thanks for the post. It worked.

    ReplyDelete
  9. Thank you very much! You made my day!!!!

    ReplyDelete
  10. You're helping people 5 years later! Worked perfectly. Thanks David!

    ReplyDelete
  11. This helped me today. Thank you! :-)

    ReplyDelete
  12. Worked for me as well. Thanks!
    -Server 2016 STD



    Error received (prior to reg fix):
    ****************************************************************
    get-windowsfeature : The given key was not present in the dictionary.
    At line:1 char:1
    + get-windowsfeature
    + ~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Get-WindowsFeature], KeyNotFoundException
    + FullyQualifiedErrorId : System.Collections.Generic.KeyNotFoundException,Microsoft.Windows.ServerManager.Commands
    .GetWindowsFeatureCommand

    ****************************************************************

    ReplyDelete
  13. Don't know if this was the same for everyone else or not but I had to make sure I exited out of Regedit before it would rebuild the key. So if, after you rename the key, it still doesn't work. Make sure that you've exited out of Regedit then try again

    ReplyDelete
  14. HI
    I resolved the issue with help of this post. Thank you

    ReplyDelete
  15. This allowed mt to continue working in a normal manner

    ReplyDelete
  16. Worked for me on Server 2019. Thank you for this!

    ReplyDelete

Post a Comment

Popular posts from this blog

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

TFTPD32 or TFTPD64 reports Bind error 10013 An attempt was made to access a socket in a way forbidden by its access permissions.

Enable function lock for F1-F12 on HP ZBook mobile workstations