Jump to content
Sign in to follow this  
scythe666

RegRead then RegWrite to another key

Recommended Posts

scythe666

Hi all,

Can anyone help me to write a script to copy one registry value into another registry key on the same device?

I'd like to copy the value from:

"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser"

To:

"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName"

Any help would be greatly appreciated. Many thanks.

Share this post


Link to post
Share on other sites
Tripredacus

Did you try the example in the help file?

$var = RegRead("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersion", "ProgramFilesDir")
RegWrite("HKEY_CURRENT_USERSoftwareTest", "TestKey", "REG_SZ", $var)

Obviously change from the example keys.

Share this post


Link to post
Share on other sites
scythe666

Now that just shows how new I am to this. I thought those were two separate examples. Thanks very much Tripredacus. I'll give that a try and let you know how I get on.

Share this post


Link to post
Share on other sites
scythe666

Tripredacus.... Huge thanks. That worked perfectly. I'll read the help file properly in future!!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×