To identify the Keys with Permission Denied in Powershell, use these commands:
Open Windows PowerShell and run these commands:
- Change Path to HKEY_LOCAL_MACHINE: PS C:\Users\Administrator> Set-Location HKLM
- Change path to appropriate Key: PS HKLM:\> cd .\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components
- Clear all the Errors: PS HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components> $Error.Clear()
- List all the keys, expected to take few minutes depending on number of keys present: PS HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components> dir -Recurse
- List all the Error Messages during the above command execution: PS HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components> $Error
- To get the Exact KeyName: PS HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components> $Error.CategoryInfo.TargetName