• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 67
  • Last Modified:

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
0
Craig Paulsen
Asked:
Craig Paulsen
  • 4
  • 3
1 Solution
 
oBdACommented:
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.
0
 
Craig PaulsenSystems EngineerAuthor Commented:
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.
0
 
oBdACommented:
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

0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
Craig PaulsenSystems EngineerAuthor Commented:
Thanks, will try this in the morning
0
 
oBdACommented:
Sorry, just noticed that the "HKLM" in the registry key got lost:
@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%\HKLM\SYSTEM\CurrentControlSet\Services\Csc\Parameters" /v FormatDatabase /t REG_DWORD /d 1 /f

Open in new window

0
 
Craig PaulsenSystems EngineerAuthor Commented:
thanks, this worked beautifully!
0
 
Craig PaulsenSystems EngineerAuthor Commented:
this worked a charm, thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now