Tuesday, 9 July 2013

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.


Network Audit and Documentation

7 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