[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

write a DOS script to add a string value to a registry key for multiple server within the same WIN2K3 domain.

Posted on 2011-02-25
6
Medium Priority
?
631 Views
Last Modified: 2012-05-11
if I need to add a string value let's say iPermit=1 under the following register key: hklm->system->currentcontrolset->control->session manager->environment of multiple domain servers, how do I write a DOS script to do that?  

Thanks
0
Comment
Question by:nav2567
[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 Comments
 
LVL 71

Accepted Solution

by:
Qlemo earned 1400 total points
ID: 34984484
For example by enumerating those servers manually in a FOR:
@echo off
for %%S in (
   server1  server2  server3
) do reg add "\\%%S\HKLM\System\CurrentControlSet\Control\Session Manager\Environment" /v "iPermit" /d 1 /f

Open in new window

0
 
LVL 2

Assisted Solution

by:Mattrw
Mattrw earned 300 total points
ID: 34984553
Generate the registry setting on a server e.g. iPermit=1 under HKLM.  Right click and export, you will use this as the example.

Open group policy gpedit.msc or under Active Directory and create a new group policy.  Under Computer settings, Windows Settings, Scripts (Startup / Shutdown).  Double click startup.  Under the Script Parameters window type regedit.exe /s path of .reg file

Change the security options to apply to your desired servers, so remove Authenticated Users.

The path of the reg file will need to be a share e.g. \\server\share with full permissions for the computers that are going to be accessing it.  Once the server has the policy, reboot it and it will post the .reg file into your servers.
0
 
LVL 8

Assisted Solution

by:subhashchy
subhashchy earned 300 total points
ID: 34984562
If the user under which batch is running does not have admin rights on the servers then you should map a drive first using admin account and then execute the reg add script.

Please  replace administraor and password with the actual username password in below script.

@echo off
for /f %%a in (list.txt) do (
echo processing server %%a
net use \\%%a\c$ /u:administrator password
reg add "\\%%a\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Ipermit /t Reg_SZ /d 1 /f
)

Open in new window

0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 

Author Comment

by:nav2567
ID: 34984621
Thanks.  

One last qustion if you do not mind.  If I need to replace a registry key with the current user ID - %username% of the system, how do I do that?  

For example, if the login id is tomt, running the script will update the registry value under hklm->system->currentcontrolset->control->session manager->environment ->iuser to become tomt\\server1.  If login id is maryh, after running the script will update the registry value under hklm->system->currentcontrolset->control->session manager->environment ->iuser to become maryh\\server1.  

Thanks.  
0
 

Author Comment

by:nav2567
ID: 34984638
Please disregard.  I will go ahead and grant points and create another question.....

Thanks everyone.  
0
 

Author Closing Comment

by:nav2567
ID: 34984641
thanks.
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

650 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