Ying Li at myITforum.com

PowerShell & System Center

PowerShell Script to create new registry key value on remote computers

In this post, I explore the ways to get remote registry key property. Here is a PowerShell script to create a new registry key value in remote registry.

$colComputers = gc c:\myworkspace\computerlist.txt

foreach ($strComputer in $colComputers)

{

#Open remote registry

$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $strComputer)

#Open the targeted remote registry key/subkey for read and write ($True)

$regKey= $reg.OpenSubKey("SOFTWARE\\Whatever\\General",$True)

#Create a new (string)value –“Override System Verification” and assign “Yes”  to it

$regKey.Setvalue('Override System Verification', 'Yes', 'String')

Comments

No Comments