I've loaded dozens of registry hives as HKLM:\temp_$username\
. Now when I try to run ls HKLM:\temp_* | %{reg unload $_}
I get ERROR: Access is denied.
I'm running PowerShell with elevated priveleges and tried restarting PowerShell ISE to clear out variables. I still receive the error. I can unload the hives using the GUI, and I can run the command for individual hives (reg unload HKLM\temp_jimbob
), so I'm a little perplexed as to why the command simply will not run for multiple hives.
What is causing the access denied error and how can I fix it?