目的是:實作授予使用者來使用遠端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
<code>PS> </code><code>Get-PSSessionConfiguration</code> <code>|fl</code> <code>*</code>
<code>Name : microsoft.powershell</code>
<code>Filename : %windir%\system32\pwrshplugin.dll</code>
<code>SDKVersion : 1</code>
<code>XmlRenderingType : text</code>
<code>lang : en-US</code>
<code>PSVersion : 2.0</code>
<code>ResourceUri : http://schemas.microsoft.com/powershell/microsoft.powershell</code>
<code>SupportsOptions : true</code>
<code>Capability : {Shell}</code>
<code>xmlns : http://schemas.microsoft.com/wbem/wsman/1/config/PluginConfiguration</code>
<code>Uri : http://schemas.microsoft.com/powershell/Microsoft.PowerShell</code>
<code>ExactMatch : false</code>
<code>SecurityDescriptorSddl : O:NSG:BAD:P(A;;GA;;;BA)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)</code>
<code>Permission : BUILTIN\Administrators AccessAllowed</code>
如果你想允許其他人這樣,那麼你需要執行
<code>PS> </code><code>Set-PSSessionConfiguration</code> <code>-Name</code> <code>Microsoft.PowerShell</code> <code>-showSecurityDescriptorUI</code>
<code>Confirm</code>
<code>Are you sure you want to perform this action?</code>
<code>Performing operation </code><code>"Set-PSSessionConfiguration"</code> <code>on Target </code><code>"Name: Microsoft.PowerShell"</code><code>.</code>
<code>[Y] Yes [A] Yes to All [N] No [L] No to All [S]</code> <code>Suspend [?] Help (</code><code>default</code> <code>is </code><code>"Y"</code><code>): y</code>
注意,這一行動可能嚴重影響您的系統,
是以我們要求你确認你真的想這樣做。
(一般我們假設你知道你在做什麼,隻有将這些消息當我們認為它是超級重要,你不要錯過任何一個消息,你總是可以添加一個這個消息)。
這就引出了下面的對話框,允許你給别人的能力,在機器上運作指令:
<a target="_blank" href="http://blog.51cto.com/attachment/201306/135639824.jpg"></a>
一切OK 好了 結束這篇博文翻譯工作,希望大家能夠學到這個小技巧。
本文轉自cantgis 51CTO部落格,原文連結:http://blog.51cto.com/cantgis/1227293,如需轉載請自行聯系原作者