Get Registry value from multiple logon user profiles

Hello All,

Need help with getting the registry key value backup from multiple user logged on machine.
Tried to get registry key value and create backup value for the same using below commands.

$HKUConfigURL = Get-RegistryKey -Key 'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Value 'AutoConfigURL' -SID $RunAsActiveUser.SID

Set-RegistryKey -Key 'HKLM\SOFTWARE\Backup\ProxySettings' -Name 'BackupConfigURL' -Value $HKUConfigURL -Type String

But its keeps failing with error code 60001 on user machines where it found 2 user sessions currently active and NO user currently logged in.

Any ideas and help will be appreciated.
Thanks in advance!!

try this to select the first Active user :
$HKUConfigURL = Get-RegistryKey -Key 'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Value 'AutoConfigURL' -SID $RunAsActiveUser[0].SID

1 Like

Thank you! will try.

Actually $(($LoggedOnUserSessions[0]).sid) worked for me.

$HKUConfigURL = Get-RegistryKey -Key 'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Value 'AutoConfigURL' -SID $(($LoggedOnUserSessions[0]).sid)

Thanks for pointing in right direction.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.