{"id":4987,"date":"2012-09-12T00:01:00","date_gmt":"2012-09-12T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2012\/09\/12\/use-powershell-to-troubleshoot-provider-load-failure\/"},"modified":"2012-09-12T00:01:00","modified_gmt":"2012-09-12T00:01:00","slug":"use-powershell-to-troubleshoot-provider-load-failure","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/use-powershell-to-troubleshoot-provider-load-failure\/","title":{"rendered":"Use PowerShell to Troubleshoot &#8220;Provider Load Failure&#8221;"},"content":{"rendered":"<p><b>Summary<\/b>: Microsoft Scripting Guy, Ed Wilson, shows how to use Windows PowerShell to troubleshoot a &ldquo;provider load failure.&rdquo;<\/p>\n<p>Hey, Scripting Guy!<\/p>\n<p>I ran across what may be an interesting issue for you.&nbsp;In one of our audit scripts last night, we received the following error:<\/p>\n<p style=\"padding-left: 30px\">Test-Connection : Provider load failure&nbsp;<\/p>\n<p style=\"padding-left: 30px\">At SomePowerShellScript.PS1:26 char:24<\/p>\n<p style=\"padding-left: 30px\">+ &nbsp; &nbsp; if (test-connection &lt;&lt;&lt;&lt; &nbsp;$srv -q -count 1) {<\/p>\n<p style=\"padding-left: 30px\">&nbsp; &nbsp; + CategoryInfo &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: InvalidOperation: (:) [Test-Connection], ManagementException<\/p>\n<p style=\"padding-left: 30px\">&nbsp; &nbsp; + FullyQualifiedErrorId : TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand<\/p>\n<p>What provider does <b>Test-Connection<\/b> use? I&#8217;m trying to research the failure. I know that another scan, which uses compiled code, did a whole slew of ping sweeps after this failed, so I don&#8217;t think the problem is at a network\/network interface layer. Also, with no changes to the system, the scripts ran fine this morning.<\/p>\n<p>I&#8217;ve done a few Internet searches for the issue and have gotten no closer, hence the email to the guru.<\/p>\n<p>Sincerely,&nbsp;<\/p>\n<p>BK<\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, is here. I am still in Redmond, Washington today. This morning I am going to have coffee (well, maybe just a cup of tea) with the scripting manager. So I am sitting in the building 43 coffee shop, working through my email. Lo and behold! I look up, and it is Jeffrey Snover coming over to say hi to me! We chat about the Hey, Scripting Guy! Blog for a bit, he confirms our meeting for this afternoon, and he heads off to his first meeting of the day. Wow. I know I have said this before (probably even yesterday), but I LOVE my job!<\/p>\n<h2>First find the provider<\/h2>\n<p>BK, I happen to know that the <b>Test-Connection<\/b> Windows PowerShell cmdlet uses the <b>Win32_PingStatus<\/b> WMI class to perform the ping. I found this out by using the <b>Get-Help<\/b> cmdlet to look up <b>Test-Connection<\/b>. In the description, it says that the cmdlet returns an instance of the <b>Win32_PingStatus<\/b> WMI class. This is shown in the image that follows.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/0728.hsg-9-12-12-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/0728.hsg-9-12-12-1.png\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>To find the provider of a WMI class, there are several approaches. Perhaps the easiest way is to use <b>wbemtest<\/b>. This is shown here.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2313.hsg-9-12-12-2.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2313.hsg-9-12-12-2.png\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>Another way to find the provider of a WMI class is to use the <b>Get-CimClass<\/b> cmdlet as shown here.<\/p>\n<p style=\"padding-left: 30px\">PS C:\\&gt; Get-CimClass win32_pingstatus | select -expand cimclassqualifiers<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs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bsp;&nbsp; Boolean &#8230;rride, ToSubclass<\/p>\n<p style=\"padding-left: 30px\">provider&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WMIPingProvider&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String &#8230;rride, ToSubclass<\/p>\n<p>When I know the WMI class and the WMI provider, there are a couple things I can do. I can look the information up on MSDN. The <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/aa392743(v=vs.85).aspx\" target=\"_blank\">WMIPingProvider<\/a> and the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/aa394350(v=vs.85).aspx\" target=\"_blank\">Win32_PingStatus<\/a> class are both documented.<\/p>\n<h2>Start a trace<\/h2>\n<p>With the name of the WMI provider and the name of the WMI class, it is time to start a trace log. I have written a <a href=\"http:\/\/blogs.technet.com\/search\/searchresults.aspx?q=trace%20log&amp;sections=7618\" target=\"_blank\">week&rsquo;s worth of Hey, Scripting Guy! Blogs<\/a> about this, and you should review those posts for fundamental concepts. Here are the steps:<\/p>\n<ol>\n<li>Open the Windows Event Viewer utility.<\/li>\n<li>On the View menu, check Show Analytic and Debug Logs.<\/li>\n<li>Navigate to Microsoft\/Windows\/WMI-Activity.<\/li>\n<li>Right-click the <b>Operational <\/b>log, and select <b>Enable Log<\/b><i> <\/i>from the <strong>Actions<\/strong> menu.<\/li>\n<li>Right-click the <b>Trace<\/b><i> <\/i>log, and select <b>Enable Log<\/b><i> <\/i>from the <strong>Actions<\/strong> menu.<\/li>\n<\/ol>\n<div><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/6864.hsg-9-12-12-3.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/6864.hsg-9-12-12-3.png\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/div>\n<h2>Wait for the problem to occur again<\/h2>\n<p>BK, now you need to wait for the problem to surface again. When the error occurs again, go back to the Event Viewer utility, navigate to the WMI-Activity log, and search through the Operational logs and Trace logs. Hopefully, you will be able to find what is causing the problem. If not, you need to enable the Debug<i> <\/i>log by using the previous procedure. Unfortunately, the Debug<i> <\/i>logs require expert WMI skills and detailed knowledge that is rarely found outside of Microsoft Customer Service and Support (CSS). Therefore, you would need to open a case with Microsoft CSS to get to the root cause.<\/p>\n<p>Join me tomorrow when I will talk about more cool Windows PowerShell stuff.<\/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><b>Ed Wilson, Microsoft Scripting Guy<\/b>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Microsoft Scripting Guy, Ed Wilson, shows how to use Windows PowerShell to troubleshoot a &ldquo;provider load failure.&rdquo; Hey, Scripting Guy! I ran across what may be an interesting issue for you.&nbsp;In one of our audit scripts last night, we received the following error: Test-Connection : Provider load failure&nbsp; At SomePowerShellScript.PS1:26 char:24 + &nbsp; &nbsp; [&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":[364,3,4,45,6],"class_list":["post-4987","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-powershell-3-0","tag-scripting-guy","tag-scripting-techniques","tag-windows-powershell","tag-wmi"],"acf":[],"blog_post_summary":"<p>Summary: Microsoft Scripting Guy, Ed Wilson, shows how to use Windows PowerShell to troubleshoot a &ldquo;provider load failure.&rdquo; Hey, Scripting Guy! I ran across what may be an interesting issue for you.&nbsp;In one of our audit scripts last night, we received the following error: Test-Connection : Provider load failure&nbsp; At SomePowerShellScript.PS1:26 char:24 + &nbsp; &nbsp; [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/4987","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=4987"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/4987\/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=4987"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=4987"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=4987"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}