?
Solved

run the regedit /e command from a utility workstation against several servers

Posted on 2003-03-19
12
Medium Priority
?
256 Views
Last Modified: 2008-02-01
I want to setup a process that exports the lanmanserver key to a reg file, But I want to setup the process to run from a remote machine.   Is there a way to run a cmd similar to this "regedit /e c:\test\test.reg "hkey_local_machine\system\currentcontrolset\services\lanmanserver\shares" but get it to go out to several servers and export the .reg file to each server locally?
0
Comment
Question by:rfmcg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 9

Expert Comment

by:MSGeek
ID: 8169328
What are you trying to accomplish, backing up that key or finding out who is sharing what?
0
 

Author Comment

by:rfmcg
ID: 8169391
I'm trying to back up the key
0
 
LVL 9

Expert Comment

by:MSGeek
ID: 8169449
That would require the same account on the remote machine be on all the target machines with the same password, otherwise your batch file would be passing a clear text password each time regdt32 authenticates to each individual machine.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:rfmcg
ID: 8169465
Yeah, no problem there, I'm a admin of all the boxes...
0
 
LVL 9

Expert Comment

by:MSGeek
ID: 8169606
0
 

Author Comment

by:rfmcg
ID: 8169918
Yeah, unfortunately as quoted on that page...
"The export operation works only with the local computer"
0
 
LVL 9

Expert Comment

by:MSGeek
ID: 8170064
Regedit is local as well.  Regedt32 will access remote registries but has no command line options that I am aware of.  Could you excute your script as part of a scheduled task to a network share or local directory?
0
 

Author Comment

by:rfmcg
ID: 8170154
So basicly you are saying schedule a task on each of the servers whose key i'm trying to back up?  Yeah, I'm assuming I can do that.   I was hoping I could use a box here that I have other scheduled tasks on, scheduling one task/script to run and go out backing up the keys I need backed up.
0
 
LVL 9

Expert Comment

by:MSGeek
ID: 8170263
It could be done as one file which calls scripts on the servers executing the reg command which could direct all dumps to a common share, you would have to have seprate directories for each server or specify a different filename for each server's dump.
0
 
LVL 85

Accepted Solution

by:
oBdA earned 300 total points
ID: 8172877
Hi rfmcg,

as always when you want something to execute on a remote machine with the least effort, you can use at.exe (well, the resource kit's "soon.exe" in this case.)
You can start with this; you can schedule it using Control Panel (not at.exe) and domain credentials, and it will then in turn schedule the backup tasks on each computer in the list.
It creates a logfile in the batch file's directory, with the name of the command file and its extension.

=====remreg.cmd========8<---snip-----------------------------------
@echo off
setlocal
rem *** A list of servers to process, separated by commas:
set ServerList=Server1,Server2
rem *** Target Directory and Prefix of the registry file (on remote computer)
rem *** - %Computername%.reg will automatically be added
rem *** - No spaces allowed in path or file name
set FileName=C:\Test\Shares-
rem *** Time to wait before the task starts:
set Delay=900
rem *** Create a logfile with the name of the command file in its directory, with the extension .log:
set Logfile=%~dpn0.log

if exist %Logfile% del %Logfile%
:loop
for /f "tokens=1* delims=, " %%a in ("%ServerList%") do (
  call :process %%a
  set ServerList=%%b
)
if not "%ServerList%"=="" goto loop
goto leave

:process
set Target=%1
ping -n 1 %Target% | find "TTL" >NUL
if errorlevel 1 goto err_Alive
soon \\%Target% %Delay% "regedit /e %FileName%%Target%.reg HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\lanmanserver\Shares" >NUL
at \\%Target% | find /i "regedit /e %FileName%%Target%.reg" >NUL
if errorlevel 1 goto err_Schedule
echo %Target%: Backup successfully scheduled.>>"%LogFile%"
goto :eof

:err_Alive
echo %Target%: Couldn't schedule job, not responding.>>"%Logfile%"
goto :eof

:err_Schedule
echo %Target%: Unable to schedule job (check credentials and service).>>"%Logfile%"
goto :eof

:leave
=============8<---snip-----------------------------------
0
 
LVL 9

Expert Comment

by:MSGeek
ID: 8174001
Well that sums it up for ya, thanks oBda.
0
 

Author Comment

by:rfmcg
ID: 8174619
Thanks oBda.   I just tested it and your solution works.  Thanks!!  Also thanks MSGeek for your help also...
This site rocks...
Now I gotta get up to speed and learn how to figure this stuff out myself!

Thanks again
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Occasionally Windows/Microsoft Updates will fail to update. We have found a code that will delete all temporary files and re-register all dll's related to Windows/Microsoft Updates! This works 99% of the time to get the updates working again! The…
Hello I read in a discussion about a person who configured a very simple mirror RAID with two hard drives; the system and data were on the same partition. He asked how to repair the system as it was not booting up anymore. In his case running …
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…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

770 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