Question

How would I go about changing the HKCU registry for a user other than the current user? I don't have any other information but the user name. I will be using AutoIT for the actual execution, but if it's AutoIT's RegWrite or if I have AutoIT run a command or execute a .reg file is not important. The core problem is accessing the HKCU registry for a different user based on the user name.

Was it helpful?

Solution

I found out how a while ago, I just forgot to update it here:

RunWait("REG" & " LOAD " & "HKU\Pos C:\Users\Pos\NTUSER.DAT", "", @SW_HIDE)
RegWrite("HKEY_USERS\Pos\somewhere", "1", "REG_SZ", $value)
RunWait("REG" & " UNLOAD " & "HKU\Pos", "", @SW_HIDE)

This is basically how it's done. Just load any user hive by using RunWait(). Then do anything to it like it's a normal registry. Then unload the hive.

OTHER TIPS

Something like this should work

$fSIDList = @TEMPDIR & "\sidlist"
RunWait(@COMSPEC & ' /c WMIC useraccount get name,sid > ' & $fSIDList)
$aSIDList = FileReadToArray($fSIDList)
FileDelete($fSIDList)
; Search the array for the username you're interested in, or create a dropdown menu with it

You can use the values returned to access the appropriate subkey in HKEY_USERS

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top