Script that runs "reg add" as admin

4.9k views Asked by At

I need help in making a script (bat, vbs, whatever) that runs at startup as a different user (admin) the following command:

reg add HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome /f /v RestoreOnStartup /t REG_DWORD /d 1

I've tried combining that with "runas /savecred /user:administrator", without any success..

Background

On my work computer, in Chrome, the Startup Options are disabled. The only way to change them is through the registry, but after every restart, it reverts back to its original form (Continue where left off disabled).

So I would like a script that does enables it every time, so I don't have to do it manually.

1

There are 1 answers

3
AudioBubble On

If you have default settings use RunAs with the administrator account, except it will be disabled (but if it isn't is will run elevated as if standard settings apply).

This is a security not a programming question.

net user administrator /active:yes

You then have to allow logon with blank password in Local Security Policy.

Then

runas /user server\administrator "notepad.exe \"c:\windows\win.ini\""

The server is YOUR computer name.

I just turn offf UAC.