{"id":16481,"date":"2010-11-17T00:01:00","date_gmt":"2010-11-17T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2010\/11\/17\/configure-remote-security-settings-for-windows-powershell\/"},"modified":"2010-11-17T00:01:00","modified_gmt":"2010-11-17T00:01:00","slug":"configure-remote-security-settings-for-windows-powershell","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/configure-remote-security-settings-for-windows-powershell\/","title":{"rendered":"Configure Remote Security Settings for Windows PowerShell"},"content":{"rendered":"<p>&nbsp;&nbsp;<\/p>\n<p><b>Summary:<\/b> Microsoft Scripting Guy, Ed Wilson, teaches how to configure remote security settings for Windows PowerShell.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-size: 10pt\"><img decoding=\"async\" height=\"34\" width=\"34\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" align=\"left\" alt=\"Hey, Scripting Guy! Question\" border=\"0\" title=\"Hey, Scripting Guy! Question\" \/><\/span>Hey, Scripting Guy! I am a Help Desk Support Manager, and I have written a series of scripts that I want to allow the help desk support people to use. These scripts collect basic information, and output to a file that is then emailed to Tier 2 support when necessary. I have found this to be an effective way to streamline our help desk operation. The problem is that I do not want to make our Tier 1 support people Administrators on the remote machines. <\/p>\n<p>&#8212; LB<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-size: 10pt\"><img decoding=\"async\" height=\"34\" width=\"34\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" align=\"left\" alt=\"Hey, Scripting Guy! Answer\" border=\"0\" title=\"Hey, Scripting Guy! Answer\" \/><\/span>Hello LB, Microsoft Scripting Guy Ed Wilson here. When I was <a href=\"http:\/\/en.wikipedia.org\/wiki\/Scuba_diving\">scuba diving<\/a> in <a href=\"http:\/\/en.wikipedia.org\/wiki\/Little_Cayman\">Little Cayman<\/a>, I had the opportunity to take pictures of <a href=\"http:\/\/en.wikipedia.org\/wiki\/Nassau_grouper\">Nassau Groupers<\/a>. These are beautiful and friendly fish as seen in the following figure, (although unfortunately endangered due to overfishing). Speaking of groupers, LB, the solution to your problem is to use groups. <\/p>\n<p><img decoding=\"async\" height=\"465\" width=\"438\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4431.HSG-11-17-10-01.jpg\" border=\"0\" \/>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>The first thing you need to do is to create a group, such as the one seen in the following figure.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3377.HSG-11-17-10-02.jpg\" border=\"0\" \/>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>If you attempt to work with the Windows PowerShell session configuration information, and you do not start Windows PowerShell as an Administrator, an error will occur. Windows PowerShell will not allow you to retrieve session configuration information if you are not running as an Administrator. This error is seen here.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8233.HSG-11-17-10-03.jpg\" border=\"0\" \/> <\/p>\n<p>&nbsp;<\/p>\n<p>After&nbsp;you start the Windows PowerShell console with admin rights (right-click the <strong>Windows PowerShell icon<\/strong> and select <b>Run as Administrator<\/b> from the <b>Action<\/b> menu), you can use the <b>Set-PSSessionConfiguration<\/b> Windows PowerShell cmdlet to modify the security configuration for Windows PowerShell <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/tags\/windows+powershell\/getting+started\/remoting\/\">remoting<\/a>. The easiest way to do this is to use the <i>ShowSecurityDescriptorUI<\/i> switched parameter to force the cmdlet to display a graphical interface that allows you to add a Security Group to the access control list for the session. In addition to using the <i>ShowSecurityDescriptorUI<\/i> switched parameter, you will also need to specify the <i>name<\/i> parameter to indicate the application to be configured. In this example, use Microsoft.PowerShell. I also like to <a href=\"http:\/\/en.wikipedia.org\/wiki\/The_Force_(Star_Wars)\"><i>use the force<\/i><\/a> parameter to keep the cmdlet from prompting me. To me the prompt is annoying, and even a little misleading, as I have not changed or configured anything yet, and the prompt says that I am going to be &#8220;Performing operation &#8220;<b>Set-PSSessionConfiguration<\/b>&#8221; on Target &#8220;Name: Microsoft.PowerShell.&#8221; This is one of those &#8220;Well, duh&#8221; moments that arise when I say &#8220;Of course I am going to run the cmdlet, I just told you to do so.&#8221; The prompt is shown here.<\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">PS C:\\Windows\\system32&gt; Set-PSSessionConfiguration -ShowSecurityDescriptorUI -Name Mi<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">crosoft.PowerShell<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">&nbsp;<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">Confirm<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">Are you sure you want to perform this action?<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">Performing operation &#8220;Set-PSSessionConfiguration&#8221; on Target &#8220;Name:<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">Microsoft.PowerShell&#8221;.<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">[Y] Yes &nbsp;[A] Yes to All&nbsp; [N] No&nbsp; [L] No to All&nbsp; [S] Suspend&nbsp; [?] Help<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">(default is &#8220;Y&#8221;):<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>The command, (which is typed on a single line, but is wrapped here for publication on the blog) incorporating the <i>force<\/i> parameter is seen here. <\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">PS C:\\Windows\\system32&gt; Set-PSSessionConfiguration -ShowSecurityDescriptorUI -Name Mi<\/span><\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">crosoft.PowerShell -Force<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>Once the command runs, the following permissions dialog box appears. As seen in the following figure, I have added the <b>PoshRemoteUsers<\/b> group and granted them full control. <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3463.HSG-11-17-10-04.jpg\" border=\"0\" \/>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>I now pop over to a remote computer, and attempt to run a script block on my <b>mred1<\/b> computer &#8211; the computer to which I just made the Windows PowerShell session configuration change. The user <b>nwtraders\\pshUser<\/b> is not a member of the <b>PoshRemoteUsers<\/b> group, and therefore as a plain everyday user, does not have remote rights to my machine. When I run the following command an error arises. <\/p>\n<p style=\"padding-left: 30px\"><span style=\"font-family: courier new,courier\">Invoke-command -computername mred1 -scriptblock {hostname} -credential nwtraders\\pshuser<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>If I execute the command as the <b>nwtraders\\posh remoteuser<\/b> the command succeeds because the <b>posh remoteuser<\/b> was added to the <b>PoshRemoteUsers<\/b> group. Keep in mind, that <b>posh remoteuser<\/b> is an ordinary user, and has no added group memberships other than membership in the <b>PoshRemoteUsers<\/b> group and the <b>Domain Users<\/b> group. This is seen in the following figure.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1323.HSG-11-17-10-05.jpg\" border=\"0\" \/>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>To test things out, I open a Remote Desktop session on a remote <a href=\"http:\/\/www.microsoft.com\/windows\/windows-7\/default.aspx\">Windows 7<\/a> desktop, open Windows PowerShell and attempt to make a connection to the <b>Mred1<\/b> computer. Because the <b>posh remoteuser<\/b> has a space in it, I thought there might be some confusion on using it from the Windows PowerShell console. Therefore I attempted different configurations of the name. The results are shown in this figure.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1643.HSG-11-17-10-06.jpg\" border=\"0\" \/>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>LB, that is all there is to configuring security for Windows PowerShell remoting. Remoting week will continue tomorrow when I will talk about working with remote sessions. <\/p>\n<p>I invite you to follow me on <a target=\"_blank\" href=\"http:\/\/bit.ly\/scriptingguystwitter\">Twitter<\/a> or <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\">Facebook<\/a>. If you have any questions, send email to me at <a target=\"_blank\" href=\"mailto:scripter@microsoft.com\">scripter@microsoft.com<\/a> or post them on the <a href=\"http:\/\/social.technet.microsoft.com\/Forums\/en\/ITCG\/threads\/\">Official Scripting Guys Forum.<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p>&nbsp;<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;&nbsp; Summary: Microsoft Scripting Guy, Ed Wilson, teaches how to configure remote security settings for Windows PowerShell. &nbsp; Hey, Scripting Guy! I am a Help Desk Support Manager, and I have written a series of scripts that I want to allow the help desk support people to use. These scripts collect basic information, and output [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[51,57,3,4,45],"class_list":["post-16481","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-getting-started","tag-remoting","tag-scripting-guy","tag-scripting-techniques","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>&nbsp;&nbsp; Summary: Microsoft Scripting Guy, Ed Wilson, teaches how to configure remote security settings for Windows PowerShell. &nbsp; Hey, Scripting Guy! I am a Help Desk Support Manager, and I have written a series of scripts that I want to allow the help desk support people to use. These scripts collect basic information, and output [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/16481","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=16481"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/16481\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=16481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=16481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=16481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}