大家好,此章的更新是我偶然间看到 windows powershellblog 中,觉得很有实际意义,所以我特意翻译给大家一起学习这个小技巧。
目的是:实现授予用户来使用远程powershell管理计算机
当我读到一些文章条目,抱怨不得不有管理访问权限来执行对远程服务器PowerShell命令但是事实上这并非如此,我们可以跳过管理员。授予一个用户来进行。
我们的默认机制是“缺省安全(secure by default)”,你就可以有信心把所有你的机器,安装PowerShell函数,我们会教你PowerShell的风险和利益的决策。
(Get-Help“Get-Help about_Execution_Policies”看到一个伟大的例子。)
这就是为什么remoting在默认情况下是关闭的,你必须运行Enable-PSRemoting。
当你开启的时候,我们创建默认的PSSessionConfiguration称为Microsoft。
和一个SDDL PowerShell,只允许人们在机器上执行远程命令。
你可以看到,通过以下命令:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
PS> Get-PSSessionConfiguration |fl *
Name : microsoft.powershell
Filename : %windir%\system32\pwrshplugin.dll
SDKVersion : 1
XmlRenderingType : text
lang : en-US
PSVersion : 2.0
ResourceUri : http://schemas.microsoft.com/powershell/microsoft.powershell
SupportsOptions : true
Capability : {Shell}
xmlns : http://schemas.microsoft.com/wbem/wsman/1/config/PluginConfiguration
Uri : http://schemas.microsoft.com/powershell/Microsoft.PowerShell
ExactMatch : false
SecurityDescriptorSddl : O:NSG:BAD:P(A;;GA;;;BA)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
Permission : BUILTIN\Administrators AccessAllowed
|
如果你想允许其他人这样,那么你需要执行
1
2
3
4
5
|
PS> Set-PSSessionConfiguration -Name Microsoft.PowerShell -showSecurityDescriptorUI
Confirm
Are you sure you want to perform this action?
Performing operation "Set-PSSessionConfiguration" on Target "Name: Microsoft.PowerShell" .
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help ( default is "Y" ): y
|
注意,这一行动可能严重影响您的系统,
所以我们要求你确认你真的想这样做。
(一般我们假设你知道你在做什么,只有将这些消息当我们认为它是超级重要,你不要错过任何一个消息,你总是可以添加一个这个消息)。
这就引出了下面的对话框,允许你给别人的能力,在机器上运行命令:

一切OK 好了 结束这篇博文翻译工作,希望大家能够学到这个小技巧。
本文转自cantgis 51CTO博客,原文链接:http://blog.51cto.com/cantgis/1227293,如需转载请自行联系原作者