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

x
?
Solved

Powershell pushing value over IP range by remote registry

Posted on 2011-03-01
4
Medium Priority
?
605 Views
Last Modified: 2012-05-11
Is there a way to push a certain registry value out over an ip range by using power shell?  I saw this the code below but thats by an individual computer.  Could you just use CMP=10.1.10.50-10.1.10.100 ?
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

0
Comment
Question by:cmb991
[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
  • 3
4 Comments
 
LVL 27

Accepted Solution

by:
KenMcF earned 2000 total points
ID: 35009304
You can use REG ADD from within a powershell script like this.

I have not tested so test before running on all computers.


$Item = "srvcomment"
$Data = "This will be the new Description of the COmputer!"
$Key = "HKLM\SYSTEM\ControlSet001\Services\LanmanServer\Parameters"
$Q = [CHAR]34
10..100 | %{
Invoke-Expression "REG ADD \\10.1.1.$($_)\$key /v $Item /t REG_SZ /d $q$Data$q /f"
}

Open in new window

0
 
LVL 1

Author Comment

by:cmb991
ID: 35009439
So would this work if execute or do you see something wrong?  It would set the value on a remote machine, then reset the remote machines network adapter:

$Item = "LOM"
$Data = "1"
$Key = "HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0011\"

REG ADD \\10.1.10.$($_)\$key /v $Item /t REG_SZ /d $q$Data$q /f

$adaptor = Get-WmiObject -Class Win32_NetworkAdapter | Where-Object {$_.Name -like "*Wireless*"}
$adaptor.Disable()
$adaptor.Enable()

Open in new window

0
 
LVL 27

Assisted Solution

by:KenMcF
KenMcF earned 2000 total points
ID: 35009709
You will need to use invoke-expression to run REG ADD

Invoke-Expression REG ADD \\10.1.10.$($_)\$key /v $Item /t REG_SZ /d $q$Data$q /f  


I am not sure about disabling the network adapter, I am not able to test right now.  
0
 
LVL 27

Assisted Solution

by:KenMcF
KenMcF earned 2000 total points
ID: 35009716
This should have quotes

Invoke-Expression "REG ADD \\10.1.10.$($_)\$key /v $Item /t REG_SZ /d $q$Data$q /f"  

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

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

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