{"id":1669,"date":"2011-07-13T12:50:29","date_gmt":"2011-07-13T16:50:29","guid":{"rendered":"http:\/\/www.bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/"},"modified":"2011-07-13T12:50:29","modified_gmt":"2011-07-13T16:50:29","slug":"why-does-catch-not-catch","status":"publish","type":"post","link":"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/","title":{"rendered":"Why does catch not catch?"},"content":{"rendered":"<p>I ran into an interesting discussion with my customer today.&nbsp; He was writing a code block that looked like the following:<\/p>\n<pre class=\"brush: ps\">Try {\nGet-MailboxServer Bogus\n}\nCatch {\n\"Mailbox server doesn't exist\"\n}<\/pre>\n<p>Looking at the code, it\u2019s very simple. Run a command in try block and if error is generated, report on it using catch. However, it didn\u2019t work as it should. That\u2019s why it became interesting.<\/p>\n<p>I tried the following:<\/p>\n<pre class=\"brush: ps\">Try {\nsomestring\n}\nCatch {\n\"Error\"\n}<\/pre>\n<p>Now that worked just as you would expect!<\/p>\n<p>What was going on here. I was puzzled and so was the engineer who asked me about the error in first place. So we looked at the <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/dd315350.aspx\" target=\"_blank\" rel=\"noopener noreferrer\">about_Try_Catch_Finally<\/a> on TechNet. As an IT Pro would usually RTFM, we went straight to examples and that looked just like our problem child. No issues when we run that example but when we run our code, it doesn\u2019t want to work.<\/p>\n<p>Again, as any other IT Pro would do, we did the next \u201clogical\u201d thing to match the example code with ours and decided we weren\u2019t specifying error type. While we both agreed that it wasn\u2019t the case, we still wanted to make sure. So we looked at the error object:<\/p>\n<pre class=\"brush: ps\">$Error[0].Exception.gettype()\n\nIsPublic IsSerial Name                                     BaseType\n-------- -------- ----                                     --------\nTrue     True     RemoteException                          System.Management.Automation.RuntimeException\n<\/pre>\n<p>Then we changed out Catch statement to specify the error type. That, as you may have guess it by now, didn\u2019t work either! <img decoding=\"async\" style=\"border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none\" class=\"wlEmoticon wlEmoticon-smile\" alt=\"Smile\" src=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-82-34-metablogapi\/7573.wlEmoticon_2D00_smile_5F00_41D9D85B.png\"\/><\/p>\n<p>This is actually when we started paying attention to TFM. If we ever read the description on the TechNet documentation, it reads \u201cDescribes how to use the Try, Catch, and Finally blocks to handle <strong><u><font color=\"#ff0000\">terminating errors<\/font><\/u><\/strong>.\u201d <\/p>\n<p>So very clearly, it says the error must be a terminating error. And the errors we were generating when executing Get-MailboxServer cmdlet, were not terminating errors! As they say it all the time, once you find the issue, fix takes only seconds. All we had to do at this point was to make the error a terminating error:<\/p>\n<pre class=\"brush: ps\">Try {\nGet-MailboxServer Bogus -ErrorAction Stop\n}\nCatch {\n\"Mailbox server doesn't exist\"\n}<\/pre>\n<p>And the world was fine once again.<\/p>\n<p>Originally posted at http:\/\/blogs.technet.com\/bshukla<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I ran into an interesting discussion with my customer today.&nbsp; He was writing a code block that looked like the following: Try { Get-MailboxServer Bogus } Catch { &#8220;Mailbox server [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"pgc_sgb_lightbox_settings":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[52,19],"tags":[],"class_list":["post-1669","post","type-post","status-publish","format-standard","hentry","category-exchange-2010","category-powershell"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Why does catch not catch? - Bhargav&#039;s IT Playground<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Why does catch not catch? - Bhargav&#039;s IT Playground\" \/>\n<meta property=\"og:description\" content=\"I ran into an interesting discussion with my customer today.&nbsp; He was writing a code block that looked like the following: Try { Get-MailboxServer Bogus } Catch { &quot;Mailbox server [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/\" \/>\n<meta property=\"og:site_name\" content=\"Bhargav&#039;s IT Playground\" \/>\n<meta property=\"article:published_time\" content=\"2011-07-13T16:50:29+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-82-34-metablogapi\/7573.wlEmoticon_2D00_smile_5F00_41D9D85B.png\" \/>\n<meta name=\"author\" content=\"Bhargav\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bhargav\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/bhargavs.com\\\/index.php\\\/2011\\\/07\\\/13\\\/why-does-catch-not-catch\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/bhargavs.com\\\/index.php\\\/2011\\\/07\\\/13\\\/why-does-catch-not-catch\\\/\"},\"author\":{\"name\":\"Bhargav\",\"@id\":\"https:\\\/\\\/bhargavs.com\\\/#\\\/schema\\\/person\\\/28f6d8c9b29f3a879483d65fc2ab5e26\"},\"headline\":\"Why does catch not catch?\",\"datePublished\":\"2011-07-13T16:50:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/bhargavs.com\\\/index.php\\\/2011\\\/07\\\/13\\\/why-does-catch-not-catch\\\/\"},\"wordCount\":334,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/bhargavs.com\\\/#\\\/schema\\\/person\\\/28f6d8c9b29f3a879483d65fc2ab5e26\"},\"image\":{\"@id\":\"https:\\\/\\\/bhargavs.com\\\/index.php\\\/2011\\\/07\\\/13\\\/why-does-catch-not-catch\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/blogs.technet.com\\\/cfs-file.ashx\\\/__key\\\/communityserver-blogs-components-weblogfiles\\\/00-00-00-82-34-metablogapi\\\/7573.wlEmoticon_2D00_smile_5F00_41D9D85B.png\",\"articleSection\":[\"Exchange 2010\",\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/bhargavs.com\\\/index.php\\\/2011\\\/07\\\/13\\\/why-does-catch-not-catch\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/bhargavs.com\\\/index.php\\\/2011\\\/07\\\/13\\\/why-does-catch-not-catch\\\/\",\"url\":\"https:\\\/\\\/bhargavs.com\\\/index.php\\\/2011\\\/07\\\/13\\\/why-does-catch-not-catch\\\/\",\"name\":\"Why does catch not catch? - Bhargav&#039;s IT Playground\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/bhargavs.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/bhargavs.com\\\/index.php\\\/2011\\\/07\\\/13\\\/why-does-catch-not-catch\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/bhargavs.com\\\/index.php\\\/2011\\\/07\\\/13\\\/why-does-catch-not-catch\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/blogs.technet.com\\\/cfs-file.ashx\\\/__key\\\/communityserver-blogs-components-weblogfiles\\\/00-00-00-82-34-metablogapi\\\/7573.wlEmoticon_2D00_smile_5F00_41D9D85B.png\",\"datePublished\":\"2011-07-13T16:50:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/bhargavs.com\\\/index.php\\\/2011\\\/07\\\/13\\\/why-does-catch-not-catch\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/bhargavs.com\\\/index.php\\\/2011\\\/07\\\/13\\\/why-does-catch-not-catch\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/bhargavs.com\\\/index.php\\\/2011\\\/07\\\/13\\\/why-does-catch-not-catch\\\/#primaryimage\",\"url\":\"http:\\\/\\\/blogs.technet.com\\\/cfs-file.ashx\\\/__key\\\/communityserver-blogs-components-weblogfiles\\\/00-00-00-82-34-metablogapi\\\/7573.wlEmoticon_2D00_smile_5F00_41D9D85B.png\",\"contentUrl\":\"http:\\\/\\\/blogs.technet.com\\\/cfs-file.ashx\\\/__key\\\/communityserver-blogs-components-weblogfiles\\\/00-00-00-82-34-metablogapi\\\/7573.wlEmoticon_2D00_smile_5F00_41D9D85B.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/bhargavs.com\\\/index.php\\\/2011\\\/07\\\/13\\\/why-does-catch-not-catch\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/bhargavs.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Why does catch not catch?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/bhargavs.com\\\/#website\",\"url\":\"https:\\\/\\\/bhargavs.com\\\/\",\"name\":\"Bhargav's IT Playground\",\"description\":\"Passion for Technology. Power of Collaboration.\",\"publisher\":{\"@id\":\"https:\\\/\\\/bhargavs.com\\\/#\\\/schema\\\/person\\\/28f6d8c9b29f3a879483d65fc2ab5e26\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/bhargavs.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/bhargavs.com\\\/#\\\/schema\\\/person\\\/28f6d8c9b29f3a879483d65fc2ab5e26\",\"name\":\"Bhargav\",\"logo\":{\"@id\":\"https:\\\/\\\/bhargavs.com\\\/#\\\/schema\\\/person\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/bhargavs.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Why does catch not catch? - Bhargav&#039;s IT Playground","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/","og_locale":"en_US","og_type":"article","og_title":"Why does catch not catch? - Bhargav&#039;s IT Playground","og_description":"I ran into an interesting discussion with my customer today.&nbsp; He was writing a code block that looked like the following: Try { Get-MailboxServer Bogus } Catch { \"Mailbox server [&hellip;]","og_url":"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/","og_site_name":"Bhargav&#039;s IT Playground","article_published_time":"2011-07-13T16:50:29+00:00","og_image":[{"url":"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-82-34-metablogapi\/7573.wlEmoticon_2D00_smile_5F00_41D9D85B.png","type":"","width":"","height":""}],"author":"Bhargav","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Bhargav","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/#article","isPartOf":{"@id":"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/"},"author":{"name":"Bhargav","@id":"https:\/\/bhargavs.com\/#\/schema\/person\/28f6d8c9b29f3a879483d65fc2ab5e26"},"headline":"Why does catch not catch?","datePublished":"2011-07-13T16:50:29+00:00","mainEntityOfPage":{"@id":"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/"},"wordCount":334,"commentCount":0,"publisher":{"@id":"https:\/\/bhargavs.com\/#\/schema\/person\/28f6d8c9b29f3a879483d65fc2ab5e26"},"image":{"@id":"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/#primaryimage"},"thumbnailUrl":"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-82-34-metablogapi\/7573.wlEmoticon_2D00_smile_5F00_41D9D85B.png","articleSection":["Exchange 2010","PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/","url":"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/","name":"Why does catch not catch? - Bhargav&#039;s IT Playground","isPartOf":{"@id":"https:\/\/bhargavs.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/#primaryimage"},"image":{"@id":"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/#primaryimage"},"thumbnailUrl":"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-82-34-metablogapi\/7573.wlEmoticon_2D00_smile_5F00_41D9D85B.png","datePublished":"2011-07-13T16:50:29+00:00","breadcrumb":{"@id":"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/#primaryimage","url":"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-82-34-metablogapi\/7573.wlEmoticon_2D00_smile_5F00_41D9D85B.png","contentUrl":"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-82-34-metablogapi\/7573.wlEmoticon_2D00_smile_5F00_41D9D85B.png"},{"@type":"BreadcrumbList","@id":"https:\/\/bhargavs.com\/index.php\/2011\/07\/13\/why-does-catch-not-catch\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/bhargavs.com\/"},{"@type":"ListItem","position":2,"name":"Why does catch not catch?"}]},{"@type":"WebSite","@id":"https:\/\/bhargavs.com\/#website","url":"https:\/\/bhargavs.com\/","name":"Bhargav's IT Playground","description":"Passion for Technology. Power of Collaboration.","publisher":{"@id":"https:\/\/bhargavs.com\/#\/schema\/person\/28f6d8c9b29f3a879483d65fc2ab5e26"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/bhargavs.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/bhargavs.com\/#\/schema\/person\/28f6d8c9b29f3a879483d65fc2ab5e26","name":"Bhargav","logo":{"@id":"https:\/\/bhargavs.com\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/bhargavs.com"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":34526,"url":"https:\/\/bhargavs.com\/index.php\/2024\/01\/30\/clearing-microsoft-teams-cache-with-powershell\/","url_meta":{"origin":1669,"position":0},"title":"Clearing Microsoft Teams Cache with PowerShell","author":"Bhargav","date":"January 30, 2024","format":false,"excerpt":"Introduction I recently came across a need to clear Teams cache. While the task might be simple, I ended up spending a little more time to address the scenarios I can foresee so the PowerShell script is more useful that a single use case. In this blog post, we'll be\u2026","rel":"","context":"In &quot;General&quot;","block_context":{"text":"General","link":"https:\/\/bhargavs.com\/index.php\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1679,"url":"https:\/\/bhargavs.com\/index.php\/2012\/05\/03\/exchange-management-shell-error-500-internal-server-error\/","url_meta":{"origin":1669,"position":1},"title":"Exchange Management Shell Error 500 &#8211; Internal Server Error","author":"Bhargav","date":"May 3, 2012","format":false,"excerpt":"I have come across this issue enough times that even if it is documented on TechNet it deserves mention here. When you launch Exchange Management Shell or try to connect to an Exchange 2010 Server remotely using PowerShell, you get error \u201c500 \u2013 Internal Server Error. There is a problem\u2026","rel":"","context":"In &quot;Exchange 2010&quot;","block_context":{"text":"Exchange 2010","link":"https:\/\/bhargavs.com\/index.php\/category\/microsoft\/exchange-server\/exchange-2010\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":721,"url":"https:\/\/bhargavs.com\/index.php\/2014\/03\/17\/ignoring-ssl-trust-in-powershell-using-system-net-webclient\/","url_meta":{"origin":1669,"position":2},"title":"Ignoring SSL Trust in PowerShell using System.Net.WebClient","author":"Bhargav","date":"March 17, 2014","format":false,"excerpt":"This article was originally posted on my PFE blog here: http:\/\/blogs.technet.com\/b\/bshukla\/archive\/2012\/08\/22\/3324650.aspx. I noticed a few inaccuracies with the article and since I am not a PFE anymore, I can\u2019t edit original article but posting updated article here for everyone to benefit from. The Problem We all at one point or\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/bhargavs.com\/index.php\/category\/microsoft\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1694,"url":"https:\/\/bhargavs.com\/index.php\/2013\/05\/10\/sql-server-2012-install-error-enabling-windows-feature-netfx3\/","url_meta":{"origin":1669,"position":3},"title":"SQL Server 2012 install error enabling Windows Feature NetFx3","author":"Bhargav","date":"May 10, 2013","format":false,"excerpt":"While creating one of many Lync scenario labs, I chose to install SQL Server 2012 instead of my usual install of SQL 2008 on Windows Server 2012. Going about my happy routine after clicking install, I expected install to complete when I returned a few hours later. Murphy never fails\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/bhargavs.com\/index.php\/category\/microsoft\/windows\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1626,"url":"https:\/\/bhargavs.com\/index.php\/2009\/05\/28\/exchange-2007-setup-error-domain-controller-override-set-registry\/","url_meta":{"origin":1669,"position":4},"title":"Exchange 2007 Setup Error: Setup Cannot use Domain Controller\u2026","author":"Bhargav","date":"May 28, 2009","format":false,"excerpt":"On one of my tests I was trying to add Hub role to a server that already had Mailbox role installed. When I started the setup, I got an error and pre-requisite check failed with error \u201cSetup cannot use domain controller 'dc1.mytest.int' because an override is set in the registry.\u201d\u2026","rel":"","context":"In &quot;Exchange 2007&quot;","block_context":{"text":"Exchange 2007","link":"https:\/\/bhargavs.com\/index.php\/category\/microsoft\/exchange-server\/exchange-2007\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1628,"url":"https:\/\/bhargavs.com\/index.php\/2009\/06\/12\/windows-server-corrupt-missing-performance-counters\/","url_meta":{"origin":1669,"position":5},"title":"Corrupt or Missing Performance Counters","author":"Bhargav","date":"June 12, 2009","format":false,"excerpt":"One of the functions in the code I posted in \u201cCheck Exchange 2003 vitals with PowerShell\u201d is to check performance counters. When running the script, you may encounter an error: Get-WmiObject : Invalid Class \u00a0 This could happen for 2 reasons: 1: You have a typo in Perf Counter object.\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/bhargavs.com\/index.php\/category\/microsoft\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_shortlink":"https:\/\/wp.me\/pkROc-qV","_links":{"self":[{"href":"https:\/\/bhargavs.com\/index.php\/wp-json\/wp\/v2\/posts\/1669","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bhargavs.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bhargavs.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bhargavs.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bhargavs.com\/index.php\/wp-json\/wp\/v2\/comments?post=1669"}],"version-history":[{"count":0,"href":"https:\/\/bhargavs.com\/index.php\/wp-json\/wp\/v2\/posts\/1669\/revisions"}],"wp:attachment":[{"href":"https:\/\/bhargavs.com\/index.php\/wp-json\/wp\/v2\/media?parent=1669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bhargavs.com\/index.php\/wp-json\/wp\/v2\/categories?post=1669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bhargavs.com\/index.php\/wp-json\/wp\/v2\/tags?post=1669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}