When using Test-Path to query the HKEY_USERS (or HKU) hive, it kept returning false even if the hive existed. This post explains how to use Test-Path for HKEY_USERS, and the modifications that we need to make.
How to use Test-Path for HKEY_USERS
Run the following command:
You’ll most probably find that you only have drives available for querying the HKLM and HKCU hives, but NOT the HKU (HKEY_USERS) hive.
In order to make this work we have two options. The first is to create a new drive and query it like so:
And the second is not to create a new drive, but to force Test-Path to use the registry provider like so:

