问题描述
我有一个脚本可以为 ansible 控制节点启用基本身份验证以连接到 Windows 主机。下面是脚本,当我执行脚本时,我收到一个错误 msg The config setting Basic cannot be changed because is controlled by policies.
Set-Service WinRM -StartMode Automatic
Set-Item -Force WSMan:\localhost\Service\Auth\Basic $True
winrm set winrm/config/service/auth '@{Basic="true"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
当我执行脚本时,我收到以下错误消息
Set-Item : The config setting Basic cannot be changed because is controlled by policies. The policy would need to be
set to "Not Configured" in order to change the config setting.
At C:\Users\krishna_venkata\Desktop\test.ps1:2 char:1
+ Set-Item -Force WSMan:\localhost\Service\Auth\Basic $True
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-Item],InvalidOperationException
+ FullyQualifiedErrorId : system.invalidOperationException,Microsoft.PowerShell.Commands.Setitemcommand
WSManFault
Message
ProviderFault
WSManFault
Message = The config setting Basic cannot be changed because is controlled by policies. The policy would need to be set to "Not Configured" in order to change the config setting.
Error number: -2144108406 0x8033808A
Cannot change GPO controlled setting.
WSManFault
Message
ProviderFault
WSManFault
Message = The config setting AllowUnencrypted cannot be changed because is controlled by policies. The policy would need to be set to "Not Configured" in order to change the config setting.
Error number: -2144108406 0x8033808A
Cannot change GPO controlled setting.
这是当前的 winrm 配置
Service
RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
MaxConcurrentOperations = 4294967295
MaxConcurrentOperationsPerUser = 1500
EnumerationTimeoutms = 240000
MaxConnections = 300
MaxPacketRetrievalTimeSeconds = 120
AllowUnencrypted = false [Source="GPO"]
Auth
Basic = false [Source="GPO"]
Kerberos = true
Negotiate = true
Certificate = false
Credssp = false
CbtHardeningLevel = Relaxed
DefaultPorts
HTTP = 5985
HTTPS = 5986
IPv4Filter = *
IPv6Filter = *
EnableCompatibilityHttpListener = false
EnableCompatibilityHttpsListener = false
CertificateThumbprint
AllowRemoteAccess = true
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)