{"id":15651,"date":"2011-02-09T00:01:00","date_gmt":"2011-02-09T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2011\/02\/09\/use-powershell-troubleshooting-packs-to-diagnose-remote-problems\/"},"modified":"2011-02-09T00:01:00","modified_gmt":"2011-02-09T00:01:00","slug":"use-powershell-troubleshooting-packs-to-diagnose-remote-problems","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/use-powershell-troubleshooting-packs-to-diagnose-remote-problems\/","title":{"rendered":"Use PowerShell Troubleshooting Packs to Diagnose Remote Problems"},"content":{"rendered":"<p><b>Summary<\/b>: Learn how to use Windows PowerShell troubleshooting packs to diagnose and correct problems with remote systems.<\/p>\n<p><img decoding=\"async\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\" \/><\/p>\n<p>&nbsp; Hey, Scripting Guy! I need to troubleshoot remote systems. In the past, we have always configured Remote Desktop on our servers to allow for remote management. The problem is that many of our remote offices have absolutely terrible bandwidth. This is especially true in the late afternoon when the applications update our central servers with the day&rsquo;s transactions. Although Remote Desktop is great when connected at LAN speeds, it is not so great for accessing a heavily loaded server via a can and string WAN. There have been times when I have actually clicked the wrong item in a management tool because the screen updates were coming so slowly. Luckily, Windows always seems to prompt before anything disastrous happens&mdash;like dropping a table from a SQL database or deleting all of the events from the Security event log. It would be great if I could just use Windows PowerShell for troubleshooting and not incur the overhead involved in&nbsp;<a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/tags\/windows+powershell\/getting+started\/remoting\/\">remoting<\/a> an entire desktop.<\/p>\n<p>&mdash;TK<\/p>\n<p><img decoding=\"async\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\" \/> Hello TK,<\/p>\n<p>Microsoft Scripting Guy Ed Wilson, here. Today is a cool day. I had two meetings cancel, so I am free for the day. I decided to spend much of the morning catching up on email that&rsquo;s been sent to the <a href=\"mailto:scripter@microsoft.com\">Scripter@Microsoft.com<\/a> address. I have <a href=\"http:\/\/en.wikipedia.org\/wiki\/The_Magic_Flute\" target=\"_blank\">The Magic Flute<\/a> by <a href=\"http:\/\/en.wikipedia.org\/wiki\/Wolfgang_Amadeus_Mozart\" target=\"_blank\">Mozart<\/a> cranked up on my <a href=\"http:\/\/zune.net\/en-us\/products\/zunehd\/default.htm\" target=\"_blank\">Zune HD<\/a> (at least loud enough to cover my operatic ambitions) and I am playing with Windows PowerShell. What could be better?<\/p>\n<p>This is the third in a series of blog posts that detail working with the Windows PowerShell troubleshooting pack cmdlets. Monday&rsquo;s blog post was <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2011\/02\/07\/use-powershell-to-troubleshoot-your-windows-7-computer.aspx\" target=\"_blank\">Use PowerShell to Troubleshoot Your Windows 7 Computer<\/a>. The second blog post was <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2011\/02\/08\/use-powershell-to-automate-windows-troubleshooting.aspx\" target=\"_blank\">Use PowerShell to Automate Windows Troubleshooting<\/a>. Please refer to these two blog posts for background information that is assumed in today&rsquo;s blog.Tommorow I will talk about <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2011\/02\/10\/use-powershell-and-scheduled-tasks-to-automate-troubleshooting.aspx\">using Windows PowerShell and Scheduled Tasks with the Troubleshooting Module to automate troubleshooting<\/a>.<\/p>\n<p>TK, by using Windows PowerShell remoting, you can indeed work with the troubleshooting pack cmdlets on a remote server or workstation. I have written <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/tags\/windows+powershell\/remoting\/\" target=\"_blank\">several Hey Scripting Guy! blogs about Windows PowerShell remoting<\/a>, and I have posted <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/tags\/windows+powershell\/remoting\/guest+blogger\/\" target=\"_blank\">several guest blogs as well.<\/a> After <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2010\/11\/16\/enable-powershell-remoting-to-enable-running-commands.aspx#comments\" target=\"_blank\">Windows PowerShell remoting is configured<\/a> it is simple to use Windows PowerShell and the troubleshooting pack cmdlets.<\/p>\n<p>To work interactively in a remote Windows PowerShell session, use the <b>Enter-PSSession<\/b> cmdlet to make a connection to a remote computer. In the example shown here, I connect to a computer named <b>hyperv-box<\/b> with the <b>nwtraders\\administrator<\/b> credentials.<\/p>\n<blockquote>\n<p>Enter-PSSession -ComputerName hyperv-box -Credential nwtraders\\administrator<\/p>\n<\/blockquote>\n<p>When this command runs, a dialog box appears that prompts me to enter the password for the <b>nwtraders\\administrator<\/b> account. The dialog box is shown in the following image.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5023.HSG-2-9-11-01_49D1FAA6.jpg\"><img decoding=\"async\" style=\"padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"Image of dialog box\" border=\"0\" alt=\"Image of dialog box\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7077.HSG-2-9-11-01_thumb_4095BF65.jpg\" width=\"448\" height=\"397\" \/><\/a><\/p>\n<p>It is interesting that the Windows PowerShell console in which I entered the command was not an elevated Windows PowerShell console. But because I specified an administrator account, the Windows PowerShell prompt that returned from the remote machine was elevated.<\/p>\n<p>The first step is to see which troubleshooting packs are available on the remote server. I use the <b>dir<\/b> alias for the <a href=\"http:\/\/www.bing.com\/visualsearch?g=powershell_cmdlets&amp;FORM=Z9GE22\">Get-Childtem <\/a>cmdlet&nbsp;to see what has been installed. The command and results are shown here. (The Windows PowerShell prompt changes to indicate the name of the remote server in square brackets.)<\/p>\n<blockquote>\n<p>[hyperv-box]: PS C:\\&gt; dir C:\\Windows\\diagnostics\\system<\/p>\n<p>Directory: C:\\Windows\\diagnostics\\system<\/p>\n<p>Mode LastWriteTime Length Name<\/p>\n<p>&#8212;- &#8212;&#8212;&#8212;&#8212;- &#8212;&#8212; &#8212;-<\/p>\n<p>d&#8212;- 7\/14\/2009 1:41 AM Networking<\/p>\n<p>d&#8212;- 7\/14\/2009 1:41 AM PCW<\/p>\n<\/blockquote>\n<p>Now I need to import the TroubleShootingPack <a href=\"http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/tags\/getting+started\/modules\/default.aspx\" target=\"_blank\">module<\/a> by using the <b>Import-Module<\/b> cmdlet. After I have accomplished that, I use the <b>Get-Command<\/b> cmdlet with the <i>module<\/i> parameter to ensure that the module loaded properly. These commands are shown here.<\/p>\n<blockquote>\n<p>[hyperv-box]: PS C:\\&gt; Import-Module troubleshootingpack<\/p>\n<p>[hyperv-box]: PS C:\\&gt; Get-Command -Module tr*<\/p>\n<p>CommandType Name Definition<\/p>\n<p>&#8212;&#8212;&#8212;&#8211; &#8212;- &#8212;&#8212;&#8212;-<\/p>\n<p>Cmdlet Get-TroubleshootingPack Get-TroubleshootingPack [-Path&#8230;<\/p>\n<p>Cmdlet Invoke-TroubleshootingPack Invoke-TroubleshootingPack [-P&#8230;<\/p>\n<\/blockquote>\n<p>To obtain an overview of what the Networking TroubleShooting Pack will accomplish, I use the <b>Get-TroubleShootingPack<\/b> cmdlet and <a href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/topics\/winpsh\/manual\/pipe.mspx\">pipe<\/a> the resulting DiagPack information to the <b>Format-List<\/b> cmdlet (<b>fl<\/b> is the alias for Format-List). The command and associated output are shown here.<\/p>\n<blockquote>\n<p>[hyperv-box]: PS C:\\&gt; Get-TroubleshootingPack C:\\Windows\\diagnostics\\system\\Networkin<\/p>\n<p>g | fl *<\/p>\n<p>Path : C:\\Windows\\diagnostics\\system\\Networking<\/p>\n<p>Id : NetworkDiagnostics<\/p>\n<p>Version : 1.0<\/p>\n<p>Publisher : Microsoft Windows<\/p>\n<p>Name : Windows Network Diagnostics<\/p>\n<p>Description : Detects problems with network connectivity.<\/p>\n<p>MinimumVersion : 6.1<\/p>\n<p>PrivacyLink : http:\/\/go.microsoft.com\/fwlink\/?LinkId=104288<\/p>\n<p>SupportsClient : True<\/p>\n<p>SupportsServer : True<\/p>\n<p>SupportsX86 : True<\/p>\n<p>SupportsAmd64 : True<\/p>\n<p>SupportsIA64 : True<\/p>\n<p>RequiresElevation : True<\/p>\n<p>Interactive : True<\/p>\n<p>RootCauses : {&#8220;%InterfaceName%&#8221; doesn&#8217;t have a valid IP configuration, Anothe<\/p>\n<p>r computer on the network has the same IP address as this comput<\/p>\n<p>er, &#8220;%InterfaceName%&#8221; doesn&#8217;t have a valid IP configuration, &#8220;%I<\/p>\n<p>nterfaceName%&#8221; doesn&#8217;t have a valid IP configuration&#8230;}<\/p>\n<p>FoundRootCauses :<\/p>\n<p>Interactions : {Select entry point, Select the network adapter to diagnose, Ple<\/p>\n<p>ase select the issue Windows should troubleshoot, What are you t<\/p>\n<p>rying to do?&#8230;}<\/p>\n<p>ExtensionPoint : #document<\/p>\n<\/blockquote>\n<p>The portion that tells me what the troubleshooting pack will detect is in the <b>RootCauses<\/b> portion. I can return only that portion of the results by using the <b>Select-Object<\/b> (<b>select<\/b> is the alias) and expanding the <b>RootCause<\/b> property. The command and associated output is shown here.<\/p>\n<blockquote>\n<p>[hyperv-box]: PS C:\\&gt; Get-TroubleshootingPack C:\\Windows\\diagnostics\\system\\Networkin<\/p>\n<p>g | select -ExpandProperty rootcauses<\/p>\n<p>Name<\/p>\n<p>&#8212;-<\/p>\n<p>&#8220;%InterfaceName%&#8221; doesn&#8217;t have a valid IP configuration<\/p>\n<p>Another computer on the network has the same IP address as this computer<\/p>\n<p>&#8220;%InterfaceName%&#8221; doesn&#8217;t have a valid IP configuration<\/p>\n<p>&#8220;%InterfaceName%&#8221; doesn&#8217;t have a valid IP configuration<\/p>\n<p>&#8220;%InterfaceName%&#8221; doesn&#8217;t have a valid IP configuration<\/p>\n<p>The default gateway is not available<\/p>\n<p>&#8220;%InterfaceName%&#8221; doesn&#8217;t have a valid IP configuration<\/p>\n<p>&#8220;%InterfaceName%&#8221; doesn&#8217;t have a valid IP configuration<\/p>\n<p>&#8220;%InterfaceName%&#8221; doesn&#8217;t have a valid IP configuration<\/p>\n<p>&#8220;%InterfaceName%&#8221; doesn&#8217;t have a valid IP configuration<\/p>\n<p>Another computer on the network has the same IP address as this computer<\/p>\n<p>The default gateway is not available<\/p>\n<p>&#8220;%InterfaceName%&#8221; doesn&#8217;t have a valid IP configuration<\/p>\n<p>Problem with wireless adapter or access point<\/p>\n<p>There might be a problem with the driver for the %InterfaceName% adapter<\/p>\n<p>The Windows wireless service is not running on this computer<\/p>\n<p>Your computer does not meet the requirements for DirectAccess<\/p>\n<p>The Diagnostics Policy Service is not running<\/p>\n<p>The Diagnostics Policy Service is disabled<\/p>\n<p>Windows is in Safe Mode.<\/p>\n<p>%RootCauseName%<\/p>\n<p>%RootCauseName%<\/p>\n<p>%RootCauseName%<\/p>\n<p>%RootCauseName%<\/p>\n<p>%RootCauseName%<\/p>\n<p>%RootCauseName%<\/p>\n<p>%RootCauseName%<\/p>\n<p>An Ethernet cable is not properly plugged in or might be broken<\/p>\n<p>A network cable is not properly plugged in or may be broken<\/p>\n<p>The %InterfaceName% adapter is disabled<\/p>\n<\/blockquote>\n<p>Those appear to be exactly the checks I am interested in seeing. Therefore, I call the troubleshooting pack by passing it to the <b>Invoke-TroubleShootingPack<\/b> cmdlet. Because this runs interactively, I have to answer several questions. The command to invoke the troubleshooting pack appears here (this is a single command that has wrapped on the line. The <b>[hyperv-box]: PS C:\\&gt;<\/b> portion is part of the prompt and not the actual command).<\/p>\n<blockquote>\n<p>[hyperv-box]: PS C:\\&gt; Get-TroubleshootingPack C:\\Windows\\diagnostics\\system\\Networkin<\/p>\n<p>g | Invoke-TroubleshootingPack<\/p>\n<\/blockquote>\n<p>The output from walking through this command is shown here.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4452.HSG-2-9-11-02_2C9C2CCF.jpg\"><img decoding=\"async\" style=\"padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"Image of output\" border=\"0\" alt=\"Image of output\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1145.HSG-2-9-11-02_thumb_7B4D426E.jpg\" width=\"604\" height=\"466\" \/><\/a><\/p>\n<p>To automate running the troubleshooting pack, run the <b>Get-TroubleShootingPack<\/b> cmdlet with the <i>answerfile<\/i> parameter. Keep in mind that the location specified for storing the answer file must exist on the remote server. Use the <b>Get-ChildItem<\/b> cmdlet (<b>dir<\/b> is the alias) to ensure that the remote location exists. The command to run the <b>Get-TroubleShootingPack<\/b> cmdlet with the <i>answerfile<\/i> parameter is shown here.<\/p>\n<blockquote>\n<p>[hyperv-box]: PS C:\\&gt; Get-TroubleshootingPack C:\\Windows\\diagnostics\\system\\Networkin<\/p>\n<p>g -answerfile c:\\fso\\network.xml<\/p>\n<\/blockquote>\n<p>As I answer the questions, the results are stored in the answer file. This interaction is shown here.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5342.HSG-2-9-11-03_2DD09FE1.jpg\"><img decoding=\"async\" style=\"padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"Image of question\/answer interaction\" border=\"0\" alt=\"Image of question\/answer interaction\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5861.HSG-2-9-11-03_thumb_645E4B25.jpg\" width=\"604\" height=\"466\" \/><\/a><\/p>\n<p>When I run the command and pass the answer file, the command runs in an automated fashion.<\/p>\n<p>TK that is all there is to using the troubleshooting pack against a remote computer. Troubleshooting Week will continue tomorrow when I will talk about <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2011\/02\/10\/use-powershell-and-scheduled-tasks-to-automate-troubleshooting.aspx\">using Windows PowerShell and Scheduled Tasks with the Troubleshooting Module to automate troubleshooting<\/a>..<\/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\">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><b>Ed Wilson, Microsoft Scripting Guy<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Learn how to use Windows PowerShell troubleshooting packs to diagnose and correct problems with remote systems. &nbsp; Hey, Scripting Guy! I need to troubleshoot remote systems. In the past, we have always configured Remote Desktop on our servers to allow for remote management. The problem is that many of our remote offices have absolutely [&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,31,3,4,134,45],"class_list":["post-15651","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-getting-started","tag-operating-system","tag-scripting-guy","tag-scripting-techniques","tag-troubleshooting","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Learn how to use Windows PowerShell troubleshooting packs to diagnose and correct problems with remote systems. &nbsp; Hey, Scripting Guy! I need to troubleshoot remote systems. In the past, we have always configured Remote Desktop on our servers to allow for remote management. The problem is that many of our remote offices have absolutely [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/15651","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=15651"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/15651\/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=15651"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=15651"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=15651"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}