非administrator用户需要执行以下步骤:
用户加到administrators组:
禁用UAC(改注册表)
为什么winrm要禁用uac,在这篇文章里可以找到:
Disable User Account Control (UAC) - Windows Server | Microsoft Docs
reg add HKLMSOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
Powershell执行:
Set-PSSessionConfiguration -Name Microsoft.PowerShell –showSecurityDescriptorUI
添加DPM用户读取、执行权限:
Powershell执行:
获取SDDL格式的当前访问描述符:
(Get-PSSessionConfiguration -Name "Microsoft.PowerShell").SecurityDescriptorSDDL
然后,您可以使用此SDDL字符串授予对任何其他服务器或工作站上PowerShell的访问权限。
注:每台服务器获得的描述符不一样,请将上面获取到描述符替换到$SDDL=“”
Powershell执行:
$SDDL = "O:NSG:BAD:P(A;;GA;;;BA)(A;;GXGR;;;S-1-5-21-3222124782-533421702-3897355594-1018)(A;;GA;;;RM)(A;;GA;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)"
Set-PSSessionConfiguration -Name Microsoft.PowerShell -SecurityDescriptorSddl $SDDL
Powershell执行
设置信任主机:
Set-Item WSMan:localhostclienttrustedhosts -value 192.168.40.63 ---DCP_IP
重启WMI服务:



