尝试查询 WSUS 服务器时出现 HTTP401
HTTP401 when trying to query WSUS server
[void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($WSUS_Server,$false,80)
The request failed with HTTP status 401: Unauthorized.
两台机器都在同一个工作组中,我已将注册表值设置为 Unrestricted
:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\ShellIds\ScriptedDiagnostics\ExecutionPolicy
为什么我会收到 401 错误?
您需要提供目标机器的凭据。
您可以使用 powershell commandlet 来实现此目的
$cred = 获取凭证
或
$password = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force
$cred= 新对象 System.Management.Automation.PSCredential ("username", $password )
[void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($WSUS_Server,$false,80)
The request failed with HTTP status 401: Unauthorized.
两台机器都在同一个工作组中,我已将注册表值设置为 Unrestricted
:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\ShellIds\ScriptedDiagnostics\ExecutionPolicy
为什么我会收到 401 错误?
您需要提供目标机器的凭据。
您可以使用 powershell commandlet 来实现此目的
$cred = 获取凭证
或
$password = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force $cred= 新对象 System.Management.Automation.PSCredential ("username", $password )