?
Solved

Powershell pushing value over IP range by remote registry

Posted on 2011-03-01
4
Medium Priority
?
600 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
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…

765 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