Nat*_*sha 4 powershell group-policy windows-server-2008-r2
在 Windows server 2008 r2 中,对于这个手动过程
打开运行>gpedit.msc>计算机配置>windows模板>windows更新>指定内网微软更新服务位置> https://www.10.101.10.10.com
并且还应该启用/禁用状态
我可以知道如何使用 powershell 来做到这一点,比如脚本吗?
这些设置在注册表部分,我在问:
在 GPMC 中,依次展开“计算机配置”、“策略”、“管理模板”、“Windows 组件”,然后单击“Windows 更新”。
在 Windows 更新详细信息窗格中,双击指定 Intranet Microsoft 更新服务位置。
这是否可以从 Powershell 脚本结束?
该策略使用多个值更新以下注册表项:
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU
Name: UseWUServer
Type: DWORD
Value: 1
Name: WUServer
Type: String
Value: "URL to Windows Update Server"
Name: WUStatusServer
Type: String
Value: "URL to Intranet Statistics Server"
Run Code Online (Sandbox Code Playgroud)
只需使用Set-ItemProperty
cmdlet设置这些值:
# Set the values as needed
$WindowsUpdateRegKey = "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU"
$WSUSServer = "https://10.101.10.10:5830"
$StatServer = "https://10.101.10.10:5830"
$Enabled = 1
# Test if the Registry Key doesn't exist already
if(-not (Test-Path $WindowsUpdateRegKey))
{
# Create the WindowsUpdate\AU key, since it doesn't exist already
# The -Force parameter will create any non-existing parent keys recursively
New-Item -Path $WindowsUpdateRegKey -Force
}
# Enable an Intranet-specific WSUS server
Set-ItemProperty -Path $WindowsUpdateRegKey -Name UseWUServer -Value $Enabled -Type DWord
# Specify the WSUS server
Set-ItemProperty -Path $WindowsUpdateRegKey -Name WUServer -Value $WSUSServer -Type String
# Specify the Statistics server
Set-ItemProperty -Path $WindowsUpdateRegKey -Name WUStatusServer -Value $StatServer -Type String
Run Code Online (Sandbox Code Playgroud)
您可能必须重新启动自动更新服务才能使更改生效
Restart-Service wuauserv -Force
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
35811 次 |
最近记录: |