Link to home
Start Free TrialLog in
Avatar of Craig Paulsen
Craig PaulsenFlag for New Zealand

asked on

Add reg key remotely to laptop

Hi,
I would like to create a batch file that prompts you for a computer name, when help desk enters the specified computer name, the batch file then adds reg key to the specified machine,
Can u please guide me as to how to set this up
Avatar of oBdA
oBdA

Basically, it comes down to something like this:
set /p Computer=Please enter the name of the remote computer:
reg.exe add "\\%Computer%\HKLM\Software\Acme" /v "SomeValue" /t REG_SZ /d "Some String Data" /f

Open in new window

But you need to provide more details, especially whether the key (the "folder" in regedit) is under HKLM or HKCU (HKCU is more complicated), and which values exactly you need to add/set.
Avatar of Craig Paulsen

ASKER

thanks for your reply oBdA
the key I'm wanting to add = reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Csc\Parameters /v FormatDatabase /t REG_DWORD /d 1 /f

this basically reset the offline cache on reboot of laptop.
Then this should do the trick:
@echo off
setlocal
set Computer=
set /p Computer=Please enter the name of the computer on which to reset the offline cache:
if "%Computer%"=="" goto :eof
reg.exe add "\\%Computer%\SYSTEM\CurrentControlSet\Services\Csc\Parameters" /v FormatDatabase /t REG_DWORD /d 1 /f

Open in new window

Thanks, will try this in the morning
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks, this worked beautifully!
this worked a charm, thank you!