Avatar of Craig Paulsen
Craig Paulsen
Flag 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
Windows BatchScripting Languages

Avatar of undefined
Last Comment
Craig Paulsen

8/22/2022 - Mon
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.
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.
oBdA

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

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Craig Paulsen

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

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Craig Paulsen

ASKER
thanks, this worked beautifully!
Craig Paulsen

ASKER
this worked a charm, thank you!
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.