0

Is it possible to edit a registry key remotely with a Powershell script? If it is, how?

I have a list of 7 servers in which I have to disable windows update settings. I've coded the following script but only can be used localy:

$regkey = "HKLM:\SOFTWARE\microsoft\......\auto update"
set-itemproperty -path $regkey -name AUOptions -value 1
set-itemproperty -path $regkey -name ElevateNonAdmins -value 0
set-itemproperty -path $regkey -name IncludeRecommendedUpdates -value 0

Any suggestion? Thanks!

Antoni
  • 2,071
  • 2
  • 24
  • 31

1 Answers1

0

Powershell's support for remote registry is done via .Net. There are lots of Google answers available. Here's one from right this site:

$Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computer1)
$RegKey= $Reg.OpenSubKey("SOFTWARE\\Veritas\\NetBackup\\CurrentVersion")

As for how to set the values is left as an exercise to the reader.

Community
  • 1
  • 1
vonPryz
  • 22,996
  • 7
  • 54
  • 65