使用 Powershell 远程编辑注册表项 [英] Editing registry keys remotely with Powershell

查看:51
本文介绍了使用 Powershell 远程编辑注册表项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 Powershell 脚本远程编辑注册表项?如果是,怎么办?

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

我有一个包含 7 个服务器的列表,我必须在其中禁用 Windows 更新设置.我编写了以下脚本,但只能在本地使用:

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

有什么建议吗?谢谢!

推荐答案

Powershell 对远程注册表的支持是通过 .Net 完成的.有很多可用的 Google 答案.这是本网站右侧的一个:

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.

这篇关于使用 Powershell 远程编辑注册表项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆