How do i change registry keys on a remote computer with powershell 2?

Posted on 2010-09-13
Last Modified: 2012-05-10
I am trying to find a way to change the value of a registry key on a lot of computers. The key i want to change is basically the 'Computer Description' which is located in HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\LanmanServer\Parameters\srvcomment
. Anyone know how this is possible with powershell or even any other way this can be done remotly.
 Thanks in advance
Question by:MOSADMIN

Expert Comment

Comment Utility
this artical explain every thing you want to know

Assisted Solution

kooswillem earned 150 total points
Comment Utility
1. Export your registry key
2. This will give something like this:

Windows Registry Editor Version 5.00

"srvcomment"="Description changed by script"

3. Delete all irrelevant value lines
4. copy the *.reg file to each workstation
5. Double click the file or execute it by script.

Or use the information on this page:
LVL 11

Accepted Solution

Ben Personick earned 350 total points
Comment Utility

You have Windows Batch scripting as on of yoru zones, asuming a batch file is an acceptable method then you can easily edit a remote computer's registry file however you like assuming that you have administrator credentials to that machine as follows:

REG ADD "\\ComputerName\HKLM\SYSTEM\ControlSet001\Services\LanmanServer\Parameters" v/ srvcomment /t REG_SZ /d "This will be the new Description of the Computer!" /f

For a bit more likely usage in a script see attached.
SET "Cmp=RemoteComputerName"
SET "Key=HKLM\SYSTEM\ControlSet001\Services\LanmanServer\Parameters
SET "Item=srvcomment"
SET "Data=This will be the new Description of the COmputer!"

REG ADD "\\%cmp%\%Key%" /v %Item% /t REG_SZ /d "%Data%" /f

Open in new window


Author Closing Comment

Comment Utility
cheers guys
LVL 11

Expert Comment

by:Ben Personick
Comment Utility
Thanks for rhe points, glad to help

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now