Given Key Was Not Present in the Dictionary — ADFS
Symptom
The following error appears in your ADFS Health Log after upgrading the Windows OS on your ADFS server:
Failed to retrieve the state of windows feature.
Reason: The given key was not present in the dictionary.
Diagnosing the issue
- Run the following command in PowerShell on your Netwrix Auditor server to query a target ADFS server, replacing
%TARGET_NAME%with the actual target server name:
Get-WindowsFeature -ComputerName %TARGET_NAME%
- The command returns the following error:
Get-WindowsFeature The given key was not present in the dictionary.
CategoryInfo: NotSpecified: (:) [Get-WindowsFeature], KeyNotFoundException
The error indicates a Windows-related issue.
Causes
- The cache
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerManager\ServicingStorage\ServerComponentCacheregistry key was corrupted. - A faulty registry item is present in the XML file that is associated with the Group Policy registry settings.
Solutions
-
Recreate the
ServerComponentCacheregistry key:- Locate the
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerManager\ServicingStorage\ServerComponentCacheregistry key in Registry Editor on your ADFS server. - Right-click the key and rename it to
ServerComponentCache.old. - Run the PowerShell command from your Netwrix Auditor server again or refresh the view in Server Manager. This will recreate the key and rebuild the server feature information.
- Locate the
-
Re-create the Group Policy and registry settings. Learn more in Group Policy error: "The given Key was not present in the dictionary" ⸱ Microsoft 𓂸."