{"id":3001,"date":"2010-05-02T20:58:00","date_gmt":"2010-05-02T20:58:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2010\/05\/02\/configuring-wsman-limits\/"},"modified":"2019-02-18T13:05:56","modified_gmt":"2019-02-18T20:05:56","slug":"configuring-wsman-limits","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/configuring-wsman-limits\/","title":{"rendered":"Configuring WSMAN Limits"},"content":{"rendered":"<p><P>As you probably know by now, all of PowerShell remoting is done via streaming extensions to WSMAN.&nbsp; <A href=\"http:\/\/en.wikipedia.org\/wiki\/WS-Management\" target=\"_blank\">WSMAN<\/A> is the SOAP-based DMTF standard protocol for managing everything.&nbsp; As you explore the limits of what you can do with WSMAN or PowerShell remoting, you may encounter errors like this:<\/P>\n<P><FONT color=\"#000080\"><FONT size=\"2\" face=\"Courier New\">[7592:0]PS&gt;<\/FONT><FONT size=\"2\"><FONT face=\"Courier New\"><STRONG> New-PSSession <BR><\/STRONG><FONT color=\"#ff0000\">[localhost] Connecting to remote server failed with the following error me <BR>ssage : The WS-Management service cannot process the request. This user is <BR>allowed a maximum number of 5 concurrent shells, which has been exceeded. <BR>Close existing shells or raise the quota for this user. For more informat <BR>ion, see the about_Remote_Troubleshooting Help topic. <BR>&nbsp;&nbsp;&nbsp; + CategoryInfo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : OpenError: (System.Manageme&#8230;.RemoteRunspa <BR>&nbsp;&nbsp; ce:RemoteRunspace) [], PSRemotingTransportException <BR>&nbsp;&nbsp;&nbsp; + FullyQualifiedErrorId : PSSessionOpenFailed<\/FONT><\/FONT><\/FONT><\/FONT><\/P>\n<P><FONT color=\"#000080\" size=\"2\" face=\"Courier New\"><\/FONT><\/P>\n<P>What is going on here is that we put in a number of default constraints into the system to protect your systems from accidental misuse.&nbsp; We didn\u2019t want a beginner PowerShell user writing a script which accidentally consumed all the resources on your servers.&nbsp; We can\u2019t protect against everything but we spent some time thinking about the common mishaps and put some default guardrails in.&nbsp;&nbsp; <\/P>\n<P>I like the story (it might even be true \ud83d\ude42 ) about software controls on some of the fighter jets.&nbsp; The SW developers knew what the design limits of the planes where so they wrote the control software so that it wouldn\u2019t exceed the capabilities of the plane.&nbsp; The pilot\u2019s reaction was, \u201cwe\u2019d only be pushing the plane to that degree when the other alternative was getting shot down \u2013 I\u2019d rather risk having the wings tear off then being guaranteed to get shot down.\u201d&nbsp; So while we put in guardrails, we also put in the ability to move those guardrails.&nbsp; Look, they are your machines.&nbsp; You are smart people.&nbsp; You often know more than we do.&nbsp; We allow you to make decisions which may be great and may hurt yourself.&nbsp;&nbsp; (NOTE: In my opinion we set some of the Maximum\u2019s too low.&nbsp; We may reevaluate some of these in the future on the grounds of general principles but let me know if you have any concrete situations where the maximums are too small.)<\/P>\n<P>If you want to change the controls, all you have to do is to CD into the WSMAN: drive and the LOCALHOST subdirectory and change things.&nbsp; It\u2019s as easy as this:<\/P>\n<P><FONT color=\"#000080\" size=\"2\" face=\"Courier New\">PS&gt; <STRONG>cd WSMan:\\localhost\\Shell<\/STRONG> <BR>PS&gt; <STRONG>dir <\/STRONG><\/FONT><\/P>\n<P><FONT color=\"#000080\" size=\"2\" face=\"Courier New\">&nbsp;&nbsp; WSManConfig: Microsoft.WSMan.Management\\WSMan::localhost\\Shell <\/FONT><\/P>\n<P><FONT color=\"#000080\" size=\"2\" face=\"Courier New\">WARNING: column &#8220;Type&#8221; does not fit into the display and was removed. <\/FONT><\/P>\n<P><FONT color=\"#000080\" size=\"2\" face=\"Courier New\">Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Value <BR>&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8211; <BR>AllowRemoteShellAccess&nbsp;&nbsp;&nbsp; true <BR>IdleTimeout&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 180000 <BR>MaxConcurrentUsers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5 <BR>MaxShellRunTime&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2147483647 <BR>MaxProcessesPerShell&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 15 <BR>MaxMemoryPerShellMB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 150 <BR>MaxShellsPerUser&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5 <\/FONT><\/P>\n<P><FONT color=\"#000080\" size=\"2\" face=\"Courier New\">PS&gt; <STRONG>Set-Item .\\MaxShellsPerUser 25<\/STRONG><\/FONT><\/P>\n<P>It is worth spending a little bit of time exploring the WSMAN drive and what you can do with it.<\/P>\n<P>To find out more about the drive and what the values mean do the following:<\/P>\n<P><FONT color=\"#000080\" size=\"2\" face=\"Courier New\">PS&gt; <STRONG>Get-Help WSMAN<\/STRONG><\/FONT><\/P>\n<P><FONT color=\"#000080\" size=\"2\" face=\"Courier New\">PS&gt; <STRONG>Get-Help About_WSMAN<\/STRONG><\/FONT><\/P>\n<P>&lt;Update &#8211; not all the settings are documented there.&nbsp; The full list is available <A href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa384372(VS.85).aspx\">HERE<\/A> &gt;<\/P>\n<P>Enjoy! <\/P>\n<P>Jeffrey Snover [MSFT] <BR>Distinguished Engineer <BR>Visit the Windows PowerShell Team blog at:&nbsp;&nbsp;&nbsp; <A href=\"http:\/\/blogs.msdn.com\/PowerShell\">http:\/\/blogs.msdn.com\/PowerShell<\/A> <BR>Visit the Windows PowerShell ScriptCenter at:&nbsp; <A href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\">http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx<\/A><\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As you probably know by now, all of PowerShell remoting is done via streaming extensions to WSMAN.&nbsp; WSMAN is the SOAP-based DMTF standard protocol for managing everything.&nbsp; As you explore the limits of what you can do with WSMAN or PowerShell remoting, you may encounter errors like this: [7592:0]PS&gt; New-PSSession [localhost] Connecting to remote server [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3001","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"blog_post_summary":"<p>As you probably know by now, all of PowerShell remoting is done via streaming extensions to WSMAN.&nbsp; WSMAN is the SOAP-based DMTF standard protocol for managing everything.&nbsp; As you explore the limits of what you can do with WSMAN or PowerShell remoting, you may encounter errors like this: [7592:0]PS&gt; New-PSSession [localhost] Connecting to remote server [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/3001","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=3001"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/3001\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=3001"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=3001"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=3001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}