Need to read the registry value from HKEY_USER.

by Jul 11, 2019


I am new to powershell, so if you see any simple mistake dont get mad 

I have to run a query against a list of computers to get the registry value of HKEY_USER

#the file contains the Computer Name and SID

$name = Get-Content -Path "C:TempPowershell ScriptsComputerList.csv"


## so far I am able to get the ComputerName and the SID and tested it with echo

#created a NEW PSDRIVE for HKU

New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS

### List all the PS drives – to verify it and it worked

##Now I want to query a REG HIVE with the SID I read from the file

Get-ItemProperty -Path 'HKU$SIDSoftware………….'|select <Key>  -> This does not work

Get-ItemProperty -Path 'HKU:S-1-5-21-329068152-12144XXXXXSoftwareSelect <KEY> -> This works

When i try to pass the $SID, it says it cannot find the path. However When i type it in manually i am able to get into the hive. Any Advice?