{"id":4173,"date":"2013-02-12T00:01:00","date_gmt":"2013-02-12T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2013\/02\/12\/learn-how-to-easily-troubleshoot-powershell-remoting\/"},"modified":"2013-02-12T00:01:00","modified_gmt":"2013-02-12T00:01:00","slug":"learn-how-to-easily-troubleshoot-powershell-remoting","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/learn-how-to-easily-troubleshoot-powershell-remoting\/","title":{"rendered":"Learn How to Easily Troubleshoot PowerShell Remoting"},"content":{"rendered":"<p><strong style=\"font-size: 12px\">Summary:<\/strong><span style=\"font-size: 12px\"> Microsoft Scripting Guy, Ed Wilson, shows you how to easily troubleshoot Windows PowerShell remoting.<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\" \/>&nbsp;Hey, Scripting Guy! I have a problem. I am running Windows&nbsp;8 on my desktop, and I have upgraded our Hyper-V servers to Windows Server&nbsp;2012. For those computers, I can easily use Windows PowerShell remoting and I have not seen a single problem. But when I attempt to connect to our servers running Windows Server 2008&nbsp;R2, and even the Windows Server&nbsp;2008 servers, then it seems to be hit or miss. I need an easy way to troubleshoot this without doing a lot of special logging and going all extreme. Can you help?<\/p>\n<p>&mdash;KG<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\" \/>&nbsp;Hello KG,<\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, is here. Well, today I am all in a dither (or a tither, not sure which). I just got a picture of Dr. Scripto through the email&mdash;no, no one has kidnapped him (&aacute; la <a href=\"http:\/\/en.wikipedia.org\/wiki\/Who%27s_Harry_Crumb%3F\" target=\"_blank\">Who&rsquo;s Harry Crumb<\/a>), no, the picture is from my friend Kurt Hudson, who is a senior technical writer on the Information Experience team. You see, he and I were in meetings together a few weeks ago when I was in Redmond, and he mentioned his hobby&mdash;welding. I suggested he might try to weld a figure of Dr. Scripto&mdash;he not only accepted the challenge, as you can see in the image here, he excelled.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/0245.HSG-2-12-13-1.jpg\"><img decoding=\"async\" title=\"Image of Dr. Scripto sculpture\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/0245.HSG-2-12-13-1.jpg\" alt=\"Image of Dr. Scripto sculpture\" \/><\/a><\/p>\n<p>Well, KG, as it turns out, I was reviewing a chapter from my <a href=\"http:\/\/www.amazon.com\/Windows-PowerShell-3-0-First-Steps\/dp\/0735676151\/ref=sr_1_1?s=books&amp;ie=UTF8&amp;qid=1360612941&amp;sr=1-1&amp;keywords=powershell+3+first+steps\" target=\"_blank\">Windows PowerShell 3.0 First Steps<\/a> book by Microsoft Press, and it seems that is the best way for me to answer your question&mdash;without the need to reinvent the wheel.<\/p>\n<p>So, here goes &hellip;<\/p>\n<h2>Troubleshooting Windows PowerShell Remoting<\/h2>\n<p>The first tool to use to see if Windows PowerShell remoting is working (or not) is the <strong>Test-WSMan<\/strong> cmdlet. Use it first on the local computer (no parameters are required). The command and its associated output are shown here.<\/p>\n<p class=\"CodeBlock\" style=\"padding-left: 30px\">PS C:\\&gt; Test-WSMan<\/p>\n<p> wsmid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : http:\/\/schemas.dmtf.org\/wbem\/wsman\/identity\/1\/wsmanidentity.xsd<br \/> ProtocolVersion : http:\/\/schemas.dmtf.org\/wbem\/wsman\/1\/wsman.xsd<br \/> ProductVendor&nbsp;&nbsp; : Microsoft Corporation<br \/> ProductVersion&nbsp; : OS: 0.0.0 SP: 0.0 Stack: 3.0<\/p>\n<p>To test a remote computer, specify the <strong>&ndash;ComputerName<\/strong><em> <\/em>parameter. This following command runs against a Windows Server 2012 domain controller named DC3.<\/p>\n<p class=\"CodeBlock\" style=\"padding-left: 30px\">PS C:\\&gt; Test-WSMan -ComputerName dc3<\/p>\n<p> wsmid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : http:\/\/schemas.dmtf.org\/wbem\/wsman\/identity\/1\/wsmanidentity.xsd<br \/> ProtocolVersion : http:\/\/schemas.dmtf.org\/wbem\/wsman\/1\/wsman.xsd<br \/> ProductVendor&nbsp;&nbsp; : Microsoft Corporation<br \/> ProductVersion&nbsp; : OS: 0.0.0 SP: 0.0 Stack: 3.0<\/p>\n<p>But the <strong>Test-WSMan<\/strong> cmdlet also works against a computer running Windows PowerShell&nbsp;2.0. The following command runs against a Windows Server 2008 domain controller named DC1.<\/p>\n<p class=\"CodeBlock\" style=\"padding-left: 30px\">PS C:\\&gt; Test-WSMan -ComputerName dc1<\/p>\n<p> wsmid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : http:\/\/schemas.dmtf.org\/wbem\/wsman\/identity\/1\/wsmanidentity.xsd<br \/> ProtocolVersion : http:\/\/schemas.dmtf.org\/wbem\/wsman\/1\/wsman.xsd<br \/> ProductVendor&nbsp;&nbsp; : Microsoft Corporation<br \/> ProductVersion&nbsp; : OS: 0.0.0 SP: 0.0 Stack: 2.0<\/p>\n<p>To examine a specific Windows PowerShell session, use the <strong>Get-PSSession<\/strong> cmdlet. The easiest way to do this is to pipe the variable containing the Windows PowerShell session to the <strong>Get-PSSession<\/strong> cmdlet. The key items to pay attention to are the computer name, the state of the session, and the availability of the session. This technique is shown here.<\/p>\n<p class=\"CodeBlock\" style=\"padding-left: 30px\">PS C:\\&gt; $ps | Get-PSSession<\/p>\n<p> &nbsp;Id Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ComputerName&nbsp;&nbsp;&nbsp; State&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ConfigurationName&nbsp;&nbsp;&nbsp;&nbsp; Availability<br \/> &nbsp;&#8212; &#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;&#8212;&nbsp;&nbsp;&nbsp; &#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;&#8212;<br \/> &nbsp; 3 Session3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ex1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Opened&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Microsoft.PowerShell&nbsp;&nbsp;&nbsp;&nbsp; Available<br \/> &nbsp; 4 Session4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dc3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Opened&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Microsoft.PowerShell&nbsp;&nbsp;&nbsp;&nbsp; Available<\/p>\n<p>To focus on a specific session, reference the session by either ID or by Name. Send the returned session object over the pipeline to the <strong>Format-List<\/strong> cmdlet and select all of the properties. This technique is shown here (using <strong>fl<\/strong> as an alias for the <strong>Format-List<\/strong> cmdlet).<\/p>\n<p class=\"CodeBlock\" style=\"padding-left: 30px\">PS C:\\&gt; Get-PSSession -Name Session4 | fl *<\/p>\n<p> State&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : Opened<br \/> IdleTimeout&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 7200000<br \/> OutputBufferingMode&nbsp;&nbsp;&nbsp; : None<br \/> ComputerName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : dc3<br \/> ConfigurationName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : Microsoft.PowerShell<br \/> InstanceId&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : c15cc80d-64f0-4096-a010-0211f0188aec<br \/> Id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 4<br \/> Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : Session4<br \/> Availability&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : Available<br \/> ApplicationPrivateData : {PSVersionTable}<br \/> Runspace&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : System.Management.Automation.RemoteRunspace<\/p>\n<p>You can remove a remote Windows PowerShell session by piping the results of <strong>Get-PSSession<\/strong> to the <strong>Remove-PSSession<\/strong> cmdlet. This technique is shown here.<\/p>\n<p class=\"CodeBlock\" style=\"padding-left: 30px\">Get-PSSession -Name Session4 | Remove-PSSession<\/p>\n<p>You can also remove a PS session directly by specifying the name to the <strong>Remove-PSSession<\/strong> cmdlet. This technique is shown here.<\/p>\n<p class=\"CodeBlock\" style=\"padding-left: 30px\">Remove-PSSession -Name session3<\/p>\n<p>KG, that is all there is to using the built-in Windows PowerShell cmdlets to troubleshooting remoting. Join me tomorrow for the exciting conclusion to Microsoft MVP and honorary Scripting Guy Richard Siddaway&rsquo;s workflow series.<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><strong>Ed Wilson, Microsoft Scripting Guy<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Microsoft Scripting Guy, Ed Wilson, shows you how to easily troubleshoot Windows PowerShell remoting. &nbsp;Hey, Scripting Guy! I have a problem. I am running Windows&nbsp;8 on my desktop, and I have upgraded our Hyper-V servers to Windows Server&nbsp;2012. For those computers, I can easily use Windows PowerShell remoting and I have not seen a [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[57,3,4,45],"class_list":["post-4173","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-remoting","tag-scripting-guy","tag-scripting-techniques","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Microsoft Scripting Guy, Ed Wilson, shows you how to easily troubleshoot Windows PowerShell remoting. &nbsp;Hey, Scripting Guy! I have a problem. I am running Windows&nbsp;8 on my desktop, and I have upgraded our Hyper-V servers to Windows Server&nbsp;2012. For those computers, I can easily use Windows PowerShell remoting and I have not seen a [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/4173","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\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=4173"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/4173\/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=4173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=4173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=4173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}