{"id":15671,"date":"2011-02-07T00:01:00","date_gmt":"2011-02-07T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2011\/02\/07\/use-powershell-to-troubleshoot-your-windows-7-computer\/"},"modified":"2011-02-07T00:01:00","modified_gmt":"2011-02-07T00:01:00","slug":"use-powershell-to-troubleshoot-your-windows-7-computer","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/use-powershell-to-troubleshoot-your-windows-7-computer\/","title":{"rendered":"Use PowerShell to Troubleshoot Your Windows 7 Computer"},"content":{"rendered":"<p><b>Summary<\/b>: Learn how to use Windows PowerShell to simplify troubleshooting your Windows 7 or Windows Server 2008 R2 computers.<\/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 was recently reading something about using the Windows PowerShell troubleshooting packs that are available in Windows 7. How can I leverage this information?<\/p>\n<p>&mdash;SW<\/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 SW,<\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, here. I am officially allowed to fly again. I am so excited. I already have two trips booked; I will be flying out to Redmond, Washington to teach a couple of Windows PowerShell classes to a group of engineers that maintain our online services. I taught a class to one member of their group a couple of years ago, and they have been attempting to bring me back ever since. The cool thing is that the first week of class will correspond with the Microsoft MVP summit, so I hope to pop into that one day. My return flight actually goes through San Diego, California, which is way cool, because I love San Diego (I actually lived there for a while). If I am lucky, the airline will strand me for a few days, and I can go <a href=\"http:\/\/en.wikipedia.org\/wiki\/Hang_Ten\" target=\"_blank\">hang ten<\/a> on some <a href=\"http:\/\/www.yourdictionary.com\/rad\" target=\"_blank\">totally rad waves<\/a>.<\/p>\n<p>SW, speaking of totally rad, one of the more impressive things one can do with Windows PowerShell is to use the troubleshooting packs. When combined with Windows PowerShell <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/tags\/windows+powershell\/getting+started\/remoting\/\" target=\"_blank\">remoting<\/a>, the results can be as impressive as Oahu&rsquo;s North Shore, which you can see in this photo I took a few years ago when I was in Honolulu teaching a Windows PowerShell class.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5444.hsg-2-7-11-1_23FD0036.jpg\"><img decoding=\"async\" style=\"padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"Photo of Oahu beach\" border=\"0\" alt=\"Photo of Oahu beach\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8686.hsg-2-7-11-1_thumb_7D1EC428.jpg\" width=\"604\" height=\"454\" \/><\/a><\/p>\n<p>NOTE: this is the first of four articles that talk about using the Troubleshooting Modules. Todays article talks about finding the troubleshooting module, and the troubleshooting packs. Tommorow&#8217;s article <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2011\/02\/08\/use-powershell-to-automate-windows-troubleshooting.aspx\">discusses automating the troubleshooting process via an answer file<\/a>. On <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2011\/02\/09\/use-powershell-troubleshooting-packs-to-diagnose-remote-problems.aspx\">Wednesday I discuss using the troubleshooting packs to diagnose remote problems<\/a>, and on Thursday I talk about <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2011\/02\/10\/use-powershell-and-scheduled-tasks-to-automate-troubleshooting.aspx\">using PowerShell and Scheduled Tasks to automate troubleshooting<\/a>.<\/p>\n<p>The TroubleShootingPack <a href=\"http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/tags\/getting+started\/modules\/default.aspx\" target=\"_blank\">module<\/a> is available in Windows 7. Because it is a module, it first needs to be imported into the current Windows PowerShell session. When working with modules, I first like to use the <b>Get-Module<\/b> command to see which modules are available. I use the <i>ListAvailable<\/i> switched parameter to return the information shown here.<\/p>\n<blockquote>\n<p>PS C:\\&gt; Get-Module -ListAvailable<\/p>\n<p>ModuleType Name ExportedCommands<\/p>\n<p>&#8212;&#8212;&#8212;- &#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Script BasicFunctions {}<\/p>\n<p>Manifest cdc1ADmodule {}<\/p>\n<p>Script ConversionModuleV6 {}<\/p>\n<p>Binary DataONTAP {}<\/p>\n<p>Script DotNet {}<\/p>\n<p>Manifest FileSystem {}<\/p>\n<p>Manifest IsePack {}<\/p>\n<p>Script ISEProfileModule {}<\/p>\n<p>Manifest MSI {}<\/p>\n<p>Manifest PowerShellPack {}<\/p>\n<p>Manifest PSCodeGen {}<\/p>\n<p>Manifest Pscx {}<\/p>\n<p>Manifest PSImageTools {}<\/p>\n<p>Manifest PSRSS {}<\/p>\n<p>Manifest PSSystemTools {}<\/p>\n<p>Manifest PSUserTools {}<\/p>\n<p>Manifest TaskScheduler {}<\/p>\n<p>Manifest WPK {}<\/p>\n<p>Manifest ActiveDirectory {}<\/p>\n<p>Manifest AppLocker {}<\/p>\n<p>Manifest BitsTransfer {}<\/p>\n<p>Manifest FailoverClusters {}<\/p>\n<p>Manifest GroupPolicy {}<\/p>\n<p>Manifest IntelvPro {}<\/p>\n<p>Manifest NetworkLoadBalancingCl&#8230; {}<\/p>\n<p>Manifest PSDiagnostics {}<\/p>\n<p>Manifest TroubleshootingPack {}<\/p>\n<\/blockquote>\n<p>The modules that are available on any given system depend to a large extent on what options are enabled, what server roles are implemented, whether the Admin Pack tools have been installed, and whether any additional software has been installed. The previous list from my computer is typical, but it reflects the installation of various community software projects in addition to some modules that I have written myself. (By the way, <a href=\"http:\/\/www.codeplex.com\/site\/search?projectSearchText=powershell%20module\" target=\"_blank\">CodePlex<\/a> has a <a href=\"http:\/\/www.codeplex.com\/site\/search?query=powershell&amp;ac=1\" target=\"_blank\">number of awesome Windows PowerShell projects<\/a>).<\/p>\n<p>When I have identified the module that I want to use (the TroubleShootingPack in this example), I need to use the <b>Import-Module Windows PowerShell<\/b> cmdlet to import the module (the cool thing about the Windows PowerShell naming convention it that quite often the names are downright intuitive). The following command imports the TroubleShootingPack module into the current Windows PowerShell session.<\/p>\n<blockquote>\n<p>Import-Module -Name TroubleShootingPack<\/p>\n<\/blockquote>\n<p>I do not need to use the <i>Name<\/i> parameter, nor do I need to spell out the entire module name if I do not want to do so. I can use positional parameters (<i>Name <\/i>is in the first position), and I can use wildcard characters to avoid spelling out the entire name. As long as there is a single match for the module name, I am OK. Therefore, I can use the <b>Import-Module<\/b> cmdlet with <i>Tr* <\/i>as indicated here to import the TroubleShootingPack module.<\/p>\n<blockquote>\n<p>Import-Module Tr*<\/p>\n<\/blockquote>\n<p>What happens if I use the <i>T*<\/i> wildcard pattern? That pattern would match both the TroubleShootingPack module on my system plus the TaskScheduler module. One might expect an error to arise. However, it does not. In fact, it loads both modules. The following code shows that the <b>Get-Module<\/b> cmdlet returns two modules.<\/p>\n<blockquote>\n<p>PS C:\\&gt; Import-Module T*<\/p>\n<p>PS C:\\&gt; Get-Module<\/p>\n<p>ModuleType Name ExportedCommands<\/p>\n<p>&#8212;&#8212;&#8212;- &#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Manifest troubleshootingPack {Get-TroubleshootingPack, Invoke-Troubleshoo&#8230;<\/p>\n<p>Script TaskScheduler {Remove-Task, Get-ScheduledTask, Stop-Task, &#8230;<\/p>\n<p>To see which commands the module provides, I use the <b>Get-Command<\/b> cmdlet with the <i>Module<\/i> parameter. This command and the results appear here.<\/p>\n<p>PS C:\\&gt; Get-Command -Module trouble*<\/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<p>PS C:\\&gt;<\/p>\n<\/blockquote>\n<p>The TroubleShootingPack provides only two cmdlets: <b>Get-TroubleShootingPack<\/b> and <b>Invoke-TroubleShootingPack<\/b>. Unfortunately, the troubleshooting cmdlets are a bit strange to use. For example, using <b>Get-TroubleShootingPack<\/b> by itself generates an error, as does an attempt to use a wildcard character as shown in the following screen shot.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8270.HSG-2-7-11-02_318F70A4.jpg\"><img decoding=\"async\" style=\"padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"Image of error message\" border=\"0\" alt=\"Image of error message\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5543.HSG-2-7-11-02_thumb_743E960F.jpg\" width=\"604\" height=\"336\" \/><\/a><\/p>\n<p>Therefore SW, the first thing I need to know after importing the TroubleShootingPack module is what troubleshooting packs are available. On my system, all of the troubleshooting packs install into a diagnostics folder in the <b>%SystemRoot%<\/b> location (C:\\Windows\\Diagnostics\\System). By using this information, I can use the <a href=\"http:\/\/www.bing.com\/visualsearch?g=powershell_cmdlets&amp;FORM=Z9GE22\" target=\"_blank\">Get-ChildItem cmdlet<\/a> to list all of the available troubleshooting packs. The command to list the troubleshooting packs and the results are shown here.<\/p>\n<blockquote>\n<p>PS C:\\&gt; Get-ChildItem 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:37 AM AERO<\/p>\n<p>d&#8212;- 7\/14\/2009 1:37 AM Audio<\/p>\n<p>d&#8212;- 7\/14\/2009 1:37 AM Device<\/p>\n<p>d&#8212;- 7\/14\/2009 1:37 AM DeviceCenter<\/p>\n<p>d&#8212;- 7\/14\/2009 1:37 AM HomeGroup<\/p>\n<p>d&#8212;- 7\/14\/2009 1:37 AM Networking<\/p>\n<p>d&#8212;- 7\/14\/2009 1:37 AM PCW<\/p>\n<p>d&#8212;- 7\/14\/2009 1:37 AM Performance<\/p>\n<p>d&#8212;- 7\/14\/2009 1:37 AM Power<\/p>\n<p>d&#8212;- 7\/14\/2009 1:37 AM Printer<\/p>\n<p>d&#8212;- 7\/14\/2009 1:37 AM Search<\/p>\n<p>d&#8212;- 7\/14\/2009 1:37 AM WindowsMediaPlayerConfiguration<\/p>\n<p>d&#8212;- 7\/14\/2009 1:37 AM WindowsMediaPlayerMediaLibrary<\/p>\n<p>d&#8212;- 7\/14\/2009 1:37 AM WindowsMediaPlayerPlayDVD<\/p>\n<p>d&#8212;- 7\/14\/2009 1:37 AM WindowsUpdate<\/p>\n<p>PS C:\\&gt;<\/p>\n<\/blockquote>\n<p>To obtain information about a troubleshooting pack, use the <b>Get-TroubleShootingPack<\/b> cmdlet and pass the path to the folder that contains the particular pack. For example, to obtain information about the AERO Troubleshooting Pack, type the command shown here. I <a href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/topics\/winpsh\/manual\/pipe.mspx\" target=\"_blank\">pipe<\/a> the information to the <b>Format-List<\/b> cmdlet to see the information.<\/p>\n<blockquote>\n<p>PS C:\\&gt; Get-TroubleshootingPack -Path C:\\Windows\\diagnostics\\system\\AERO | Format-List<\/p>\n<p>Path : C:\\Windows\\diagnostics\\system\\AERO<\/p>\n<p>Id : AeroDiagnostic<\/p>\n<p>Version : 1.0<\/p>\n<p>Publisher : Microsoft Windows<\/p>\n<p>Name : Aero<\/p>\n<p>Description : Display Aero effects such as transparency.<\/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 : {Mirror drivers don&#8217;t support Aero effects, Aero effects not sup<\/p>\n<p>ported on this Windows edition, Video card doesn&#8217;t support requi<\/p>\n<p>red display settings, Video card driver doesn&#8217;t support Aero eff<\/p>\n<p>ects&#8230;}<\/p>\n<p>FoundRootCauses :<\/p>\n<p>Interactions : {This troubleshooter can&#8217;t run in a Remote Desktop session}<\/p>\n<p>ExtensionPoint : #document<\/p>\n<\/blockquote>\n<p>If I want to see what root causes the troubleshooting pack is able to detect, I select and expand the <b>RootCauses<\/b> property as shown here. (The following command is a single logical command. I continued the command to the next line by breaking the command at the pipe character for display on the blog).<\/p>\n<blockquote>\n<p>PS C:\\&gt; Get-TroubleshootingPack -Path C:\\Windows\\diagnostics\\system\\AERO |<\/p>\n<p>Select-Object -ExpandProperty RootCauses<\/p>\n<p>Name<\/p>\n<p>&#8212;-<\/p>\n<p>Mirror drivers don&#8217;t support Aero effects<\/p>\n<p>Aero effects not supported on this Windows edition<\/p>\n<p>Video card doesn&#8217;t support required display settings<\/p>\n<p>Video card driver doesn&#8217;t support Aero effects<\/p>\n<p>Color depth is set too low<\/p>\n<p>Desktop Window Manager Session Manager service isn&#8217;t running<\/p>\n<p>Themes service isn&#8217;t running<\/p>\n<p>Current power settings don&#8217;t support Aero desktop effects<\/p>\n<p>Desktop Window Manager is disabled<\/p>\n<p>Transparency is disabled<\/p>\n<p>The Windows Experience Index has not been computed<\/p>\n<p>The current theme doesn&#8217;t support Aero<\/p>\n<\/blockquote>\n<p>To run a troubleshooting pack, I need to first use <b>Get-TroubleShootingPack<\/b> to retrieve an instance of a troubleshooting pack, and then I can pipe it to the <b>Invoke-TroubleShootingPack<\/b> cmdlet. If you run a troubleshooting pack from a non-elevated Windows PowerShell console, chances are that it will report that no problems are detected as shown here.<\/p>\n<blockquote>\n<p>PS C:\\&gt; Import-Module tr*<\/p>\n<p>PS C:\\&gt; Get-TroubleshootingPack C:\\Windows\\diagnostics\\system\\Audio | Invoke-Troubles<\/p>\n<p>hootingPack<\/p>\n<p>No problems were detected<\/p>\n<p>PS C:\\&gt;<\/p>\n<\/blockquote>\n<p>This can be really misleading. To use the troubleshooting pack to look for problems, the Windows PowerShell console needs to be run with Administrative rights. I right-click the Windows PowerShell console icon and choose &ldquo;Run as Administrator&rdquo; from the task list as shown here.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8105.HSG-2-7-11-03_69518EFA.jpg\"><img decoding=\"async\" style=\"padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"Tasks list\" border=\"0\" alt=\"Tasks list\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2335.HSG-2-7-11-03_thumb_46AD507F.jpg\" width=\"404\" height=\"418\" \/><\/a><\/p>\n<p>After I have an elevated Windows PowerShell console, I can import the module, retrieve the specific troubleshooting pack, and then invoke the troubleshooting pack. The specific commands are shown here.<\/p>\n<blockquote>\n<p>PS C:\\&gt; Import-Module tr*<\/p>\n<p>PS C:\\&gt; Get-TroubleshootingPack C:\\Windows\\diagnostics\\system\\Audio | Invoke-Troubles<\/p>\n<p>hootingPack<\/p>\n<\/blockquote>\n<p>The output from the Audio TroubleShooting Pack is shown in the following screen shot.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7127.HSG-2-7-11-04_0381D252.jpg\"><img decoding=\"async\" style=\"padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"Troubleshooting output\" border=\"0\" alt=\"Troubleshooting output\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4810.HSG-2-7-11-04_thumb_38CAE4B7.jpg\" width=\"604\" height=\"346\" \/><\/a><\/p>\n<p>SW, that is all there is to using the troubleshooting packs with Windows PowerShell. Troubleshooting Week will continue tomorrow when I will continue talking about <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2011\/02\/08\/use-powershell-to-automate-windows-troubleshooting.aspx\">using answer files to automate the Windows PowerShell troubleshooting packs<\/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 to simplify troubleshooting your Windows 7 or Windows Server 2008 R2 computers. &nbsp; Hey, Scripting Guy! I was recently reading something about using the Windows PowerShell troubleshooting packs that are available in Windows 7. How can I leverage this information? &mdash;SW Hello SW, Microsoft Scripting Guy, Ed Wilson, [&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-15671","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 to simplify troubleshooting your Windows 7 or Windows Server 2008 R2 computers. &nbsp; Hey, Scripting Guy! I was recently reading something about using the Windows PowerShell troubleshooting packs that are available in Windows 7. How can I leverage this information? &mdash;SW Hello SW, Microsoft Scripting Guy, Ed Wilson, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/15671","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=15671"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/15671\/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=15671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=15671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=15671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}