?
Solved

Create registry key Under HKLM-software-microsoft-windows-currentversion-run

Posted on 2008-11-07
5
Medium Priority
?
1,339 Views
Last Modified: 2012-05-05
I need to create registry key Under HKLM-software-microsoft-windows-currentversion-run
The key tiltle will by xyz and it should read a file path to execute.  I have to make this change to multiple servers remotely.  Please advise
0
Comment
Question by:rezzman
5 Comments
 
LVL 6

Expert Comment

by:guydemarco
ID: 22909406
Copy the below into a notepad text file. Modify as needed, then save. Rename the file extension to .REG and you can auto-import it into any registry.
Windows Registry Editor Version 5.00
 
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"XYZ"="C:\\Program Files\\Your Directory\\YourExecutable.exe"

Open in new window

0
 
LVL 2

Expert Comment

by:-JerodR
ID: 22909418
Create the key on a computer using regedit (start > run > regedit).  Right click the key and export it.  Then you can copy the .reg file it creates to the remote computers and execute it.  After the .reg file is executed on the remote machine, the new key will be added to the registry on the remote machine.
0
 
LVL 6

Expert Comment

by:guydemarco
ID: 22909466
A .REG file, by the by, is executable to import into the registry. Make sure you modify that last line to what you need, the rest should work as-is. Don't forget the double slashes on the last line of the code I posted.
0
 
LVL 5

Expert Comment

by:arshana
ID: 22911319
you would need some kind of a software that allows you to modify registry of multiple computers from one place. I assume you are using a domain environment. Try using ideal dispatch (http://www.pointdev.com) it should help.
0
 
LVL 85

Accepted Solution

by:
oBdA earned 1500 total points
ID: 22916354
You have everything you need to do this remotely on your XP/W2k3 machine: reg.exe
reg.exe is able to add entries to remote machines as well, and with the aid of a batch script, you can do the lot at once.
The basic command (from a command prompt) would be

reg.exe add "\\<RemoteServerNameOrIPAddress>\HKLM\Software\Microsoft\Windows\CurrentVersion\Run" /v "xyz" /d "C:\Wherever\program.exe" /f

How many servers are we talking about here?
The easiest way to do this for several machines is to use a batch script (save as regrun.cmd or whatever.cmd) like the one below; just change the ServerList variable to contain your list of servers.
If the number of machines is getting way into the double digits, the second example might be easier, where you provide a list with the machine names in it (one server name/IP address per line).
Note that in order for your to test them, both scripts are in test mode; they will only print out the reg.exe command they would normally run.
To run them for real, remove the capitalized ECHO in front of reg.exe.
REM ----- Begin example 1 -----
@echo off
setlocal
set ServerList=Server1 Server2 Server3 Server4 Server5
set RunTitle=XYZ
set RunProgram=C:\Wherever\program.exe
for %%a in (%ServerList%) do (
  echo Processing %%a ...
  ECHO reg.exe add "\\%%a\HKLM\Software\Microsoft\Windows\CurrentVersion\Run" /v "%RunTitle%" /d "%RunProgram%" /f
)
REM ----- End example 1 -----
 
REM ----- Begin example 2 -----
@echo off
setlocal
set ServerFile=C:\Temp\Serverlist.txt
set RunTitle=XYZ
set RunProgram=C:\Wherever\program.exe
for /f %%a in ('type "%ServerFile%"') do (
  echo Processing %%a ...
  ECHO reg.exe add "\\%%a\HKLM\Software\Microsoft\Windows\CurrentVersion\Run" /v "%RunTitle%" /d "%RunProgram%" /f
)
REM ----- End example 2 -----

Open in new window

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question