通过PowerShell编辑本地策略

我正在寻找一种方法来通过PowerShell来编辑这个策略:

计算机configuration – >pipe理模板 – >系统 – >凭据委派 – > 允许使用仅限NTLM的服务器身份validation委派新凭据

我想激活它,并把*值。

我已经尝试过了,但不起作用:

$allowed = @('WSMAN/*') $key = 'hklm:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation' if (!(Test-Path $key)) { md $key } New-ItemProperty -Path $key -Name AllowFreshCredentials -Value 1 -PropertyType Dword -Force $key = Join-Path $key 'AllowFreshCredentials' if (!(Test-Path $key)) { md $key } $i = 1 $allowed |% { New-ItemProperty -Path $key -Name $i -Value $_ -PropertyType String -Force $i++ } 

它不起作用,Powershell生成一个错误“WinRM客户端无法处理请求。计算机策略不允许将用户凭据委托给目标计算机”

我也尝试手动激活政策,它的工作原理。

我的电脑不在域中,但在工作组中,我使用Powershell v4.0运行Windows 7。

谢谢你的帮助

这是我如何解决它:

 New-ItemProperty -Path 'hklm:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation' -Name "AllowFreshCredentialsWhenNTLMOnly" -Value 1 -PropertyType Dword -Force New-Item -Path 'hklm:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation' -Name "AllowFreshCredentialsWhenNTLMOnly" -Value "Default Value" -Force New-ItemProperty -Path 'hklm:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation\AllowFreshCredentialsWhenNTLMOnly' -Name "1" -PropertyType "String" -Value '*'