Search code examples
windowspowershellregistry

How to read HKCU Registry key of another user in admin on powershell?


I have a PowerShell script that runs automatically thanks to a TaskScheduler and its purpose is to take the version of all the software suites of the system in order to make a list and to quickly have an overview of the versions that are outdated. The problem is that in order for it to run at any time, the script is assigned to the SYSTEM user. However, some applications are only assigned to one user and SYSTEM cannot find them in its HKCU key.

So the question is, how can I list all the content?


Solution

  • You will need to load their hive first

    REG LOAD HKEY_Users\johnshive "C:\Users\john\NTUSER.DAT" 
    

    You can then address their hive via powershell e.g.

    Get-ChildItem -Path Registry::HKEY_USERS\johnshive