如何允许非pipe理员用户访问winrs?

我有Windows Server 2012(和Server 2008,但它是下一个优先事项)使用txwinrm来监视它。 txwinrm库在内部使用WinRS协议。 我必须使用最小特权用户来监视它,但不知道如何为他configuration访问权限。

所有我设法做的 – 是为我的用户configuration远程Powershell会话,但是看起来winrs和powershell会话有不同的安全描述符:

Invoke-Command -ComputerName 192.168.173.206 -Credential (credential Administrator $pwd) -ScriptBlock { 2 + 2} # gives 4 Invoke-Command -ComputerName 192.168.173.206 -Credential (credential lpu1 $pwd) -ScriptBlock { 2 + 2} # gives 4 winrs -r:192.168.173.206 -u:Administrator -p:$pwd 'powershell -command "2+2"' # gives 4 winrs -r:192.168.173.206 -u:lpu1 -p:$pwd 'powershell -command "2+2"' # Gives Winrs error: Access is denied. 

我的用户configuration如下:

 (Get-Item WSMan:\localhost\Service\RootSDDL).value # O:NSG:BAD:P(A;;GA;;;BA)(A;;GA;;;S-1-5-21-3231263931-1371906242-1889625497-1141)S:P(AU;FA;GA;;;WD)(AU;SA;GWGX;;;WD) (Get-PSSessionConfiguration -name Microsoft.Powershell).SecurityDescriptorSddl # O:NSG:BAD:P(A;;GA;;;BA)(A;;GA;;;S-1-5-21-3231263931-1371906242-1889625497-1149)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD) 

(在每个安全描述符中,我的用户被授予对受保护对象的一般访问权限)。

那么我应该设置什么安全描述符来让我的winrs查询适用于非pipe理员用户呢?

UPD:最近我发现,我可以检索有关winrm shell的信息 :

  winrm enumerate shell Shell ShellId = 3793B153-CCCF-4500-99FB-8534074E1738 ResourceUri = http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd 

而且我在WSMan:\localhost\Plugin目录中找不到这样的资源URI。 🙁 文档状态:

资源URI可用于检索特定于shell实例的插件configuration。

但是,如何检索该插件configuration以及如何更改?

什么工作是

 winrm configSDDL default 

然后允许读取和执行权限。 但奇怪的是,那里的设置与WSMan:\localhost\Service\RootSDDL中的设置相同。 这可能是因为winrm configSDDL重新加载一些caching或什么的,我不知道…

你可以添加用户使用:

winrm configSDDL http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd

资源

您必须将winrm服务器上的用户添加到组“远程pipe理用户”

就这么简单。