{"id":536,"date":"2019-02-21T19:31:51","date_gmt":"2019-02-22T01:31:51","guid":{"rendered":"http:\/\/zewwy.ca\/?p=536"},"modified":"2019-02-21T19:31:51","modified_gmt":"2019-02-22T01:31:51","slug":"wmi-and-the-wbemtest","status":"publish","type":"post","link":"https:\/\/zewwy.ca\/index.php\/2019\/02\/21\/wmi-and-the-wbemtest\/","title":{"rendered":"WMI and the WBEMTEST"},"content":{"rendered":"<h1 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"WMI_and_the_WBEMTEST\"><\/span><strong>WMI and the WBEMTEST<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>I&#8217;ll try and keep this post short, as I have many things to catch up on, and this just happened to be one of those things I haven&#8217;t done in a while and had to do today for some newer servers that have been configured.<\/p>\n<p>Now since I hadn&#8217;t blogged about this myself I went out to the interests to give me a good reminder on how to accomplish this. My first hit was, <a href=\"https:\/\/4sysops.com\/archives\/wbemtest-part-1-testing-wmi-connectivity\/\">Sysops<\/a>&#8230; and I usually really like this site&#8230;. well till i read this&#8230;<\/p>\n<p>&#8220;Access denied should be self-explanatory. The credentials you use must have administrator rights.&#8221;<\/p>\n<p>Ughhhhh I&#8217;m sorry what did you just say? No I don&#8217;t think so, WMI maybe, by default, restricted, but it doesn&#8217;t require such drastic permissions to utilize.<\/p>\n<p>My second <a href=\"https:\/\/docs.bmc.com\/docs\/display\/public\/btco100\/Setting+WMI+user+access+permissions+using+the+WMI+Control+Panel\">find was a lot nicer<\/a>, in particular telling you how to manage those permissions, without ahem need administrator access lol.<\/p>\n<p>So lets follow along shall we! so much for short..<\/p>\n<p>First order of busy-nas is creating a user:<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/KGnuqWx.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/KGnuqWx.png\" alt=\"\" width=\"572\" height=\"366\" \/><\/a><\/p>\n<p>Of course WMI being Windows Management Interface, means I&#8217;m making obviously a windows domain user. Nothing special, especially no admin.. \ud83d\ude1b<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/e9VPPQK.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/e9VPPQK.png\" alt=\"\" width=\"429\" height=\"371\" \/><\/a><\/p>\n<p>Again, nothing special here. Alright now I need two servers, well I guess in this case the server being monitored is sort of like a client&#8230; ugh anyway&#8230;<\/p>\n<p>I guess fo r now I&#8217;ll just login to my exchange server and wmi query another server to test out first off&#8230; mhmm all I have besides that are core servers, oh boy ok&#8230; I think I&#8217;m going to need to spin up a new testing server one second&#8230;<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/Ac87AQh.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/Ac87AQh.png\" alt=\"\" width=\"709\" height=\"316\" \/><\/a><\/p>\n<p>OK all basic settings&#8230;<\/p>\n<p>remove floppy boot into EUFI:<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/Ks00iCW.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/Ks00iCW.png\" alt=\"\" width=\"693\" height=\"621\" \/><\/a><\/p>\n<p>Boot system&#8230; attach disc from local host&#8230;<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/Zr36Pz3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/Zr36Pz3.png\" alt=\"\" width=\"1024\" height=\"739\" \/><\/a><\/p>\n<p>lets find us some windows erver 2016&#8230;. bug CD-ROM stuck &#8220;connecting&#8221;&#8230;<br \/>\nClose vSphere, reopen console, try again&#8230;<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/79UJDrX.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/79UJDrX.png\" alt=\"\" width=\"1021\" height=\"686\" \/><\/a><\/p>\n<p>always loved this trick over uploading a ISO to a datastore&#8230;.<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/KowLvhD.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/KowLvhD.png\" alt=\"\" width=\"984\" height=\"178\" \/><\/a><\/p>\n<p>Ahh modern Windows still giving off that great nostalgic feel.. \ud83d\ude00<\/p>\n<p>yada yada, setup, vmware tools, and join domain, you get the jist of it.<\/p>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Ping_and_the_Firewall\"><\/span>Ping and the Firewall<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>First order of Business Ping and the Firewall!<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/YlQyekT.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/YlQyekT.png\" alt=\"\" width=\"755\" height=\"488\" \/><\/a><\/p>\n<p>Ahh yes connectivity verified (I knew it was good cause I joined the system to the domain, but I like ping&#8230; just nothing like a good ICMP) good thing that m is not a u&#8230;.<\/p>\n<p>Anyway time to run WBEMTEST, bet the first attempt fails cause the firewall again&#8230;. hour glass&#8230; and (not responding) yeah&#8230;. sounds like a stupid firewall&#8230;<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/1MFR08H.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/1MFR08H.png\" alt=\"\" width=\"479\" height=\"458\" \/><\/a><\/p>\n<p>What?! no way RPC error&#8230; lol I totally saw this coming cause again a default server installation doesn&#8217;t allow these connections through the firewall by default.<\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/desktop\/wmisdk\/connecting-to-wmi-remotely-starting-with-vista\">This is a bit old,<\/a> but lets see if it still works&#8230;<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/fzhTBP6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/fzhTBP6.png\" alt=\"\" width=\"968\" height=\"94\" \/><\/a><\/p>\n<p><a href=\"https:\/\/i.imgur.com\/SPsBihR.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/SPsBihR.png\" alt=\"\" width=\"465\" height=\"397\" \/><\/a><\/p>\n<p>Amazing it worked&#8230; but yes this was just to verify connectivity through the firewall&#8230; so&#8230;<\/p>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"WBEMTEST_Testing_WMI_with_Least_Privileges\"><\/span>WBEMTEST Testing WMI with Least Privileges<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>OK now that we verified connectivity to the wmi stack with wbemtest using our admin account, lets do it again as a normal domain user. Just to validate these credentials were OK as a standard user i logged into a normal workstation with it, if you want to protect this even further you&#8217;d use GPOs to disallow this account local logon. Anyway&#8230;<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/N5RJylN.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/N5RJylN.png\" alt=\"\" width=\"407\" height=\"455\" \/><\/a><\/p>\n<p><a href=\"https:\/\/i.imgur.com\/2PjMKjs.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/2PjMKjs.png\" alt=\"\" width=\"398\" height=\"449\" \/><\/a><\/p>\n<p>What?! Access denied&#8230; lol again expected.. now instead of granting this account admin access, which is overkill, lets grant it the basic enable and remote access on the WMI object&#8230; so back on the server we want to be monitored via WMI&#8230;<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/XJuv2SM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/XJuv2SM.png\" alt=\"\" width=\"371\" height=\"198\" \/><\/a><\/p>\n<p><a href=\"https:\/\/i.imgur.com\/uqH4U6U.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/uqH4U6U.png\" alt=\"\" width=\"382\" height=\"289\" \/><\/a><a href=\"https:\/\/i.imgur.com\/Cdk1HF6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/Cdk1HF6.png\" alt=\"\" width=\"415\" height=\"464\" \/><\/a><\/p>\n<p><a href=\"https:\/\/i.imgur.com\/ztAaPqB.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/ztAaPqB.png\" alt=\"\" width=\"840\" height=\"501\" \/><\/a><\/p>\n<p>Hope that was easy enough to follow without even saying anything.. anyway lets try that connection again&#8230;<\/p>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Try_2_Scale-able\"><\/span>Try 2, Scale-able<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Mhmmm access still denied&#8230; <a href=\"https:\/\/serverfault.com\/questions\/28520\/which-permissions-rights-does-a-user-need-to-have-wmi-access-on-remote-machines\">lets see here<\/a><\/p>\n<p>This is how I normally do it for a monitoring account anyway cause it usually needs more permissions when mointoring a server so lets try it that way&#8230; revert the direct permissions&#8230; and grant performance group access&#8230;<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/ukFijn1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/ukFijn1.png\" alt=\"\" width=\"837\" height=\"545\" \/><\/a><\/p>\n<p>Now lets add wmi reader account to the dcom groujps and the performance monitor group and reboot the server&#8230;<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/gr2GuDD.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/gr2GuDD.png\" alt=\"\" width=\"862\" height=\"486\" \/><\/a><\/p>\n<p>Server rebooting, back up, and lets test that connection again on wbemtest!<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/K2LYKBz.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/K2LYKBz.png\" alt=\"\" width=\"588\" height=\"467\" \/><\/a><\/p>\n<p>and&#8230;.<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/DXKzMT4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/DXKzMT4.png\" alt=\"\" width=\"465\" height=\"389\" \/><\/a><\/p>\n<p>Bazzaaaaaa! An account thats not a admin anywhere with permissions needed to monitor your server with WMI! Use these accounts on software such as PRTG, Splunk, Zenoss, etc etc.<\/p>\n<p>Hope everyone enjoyed this tutorial on WMI configuration and testing. \ud83d\ude00<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WMI and the WBEMTEST I&#8217;ll try and keep this post short, as I have many things to catch up on, and this just happened to be one of those things I haven&#8217;t done in a while and had to do today for some newer servers that have been configured. Now since I hadn&#8217;t blogged about &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/zewwy.ca\/index.php\/2019\/02\/21\/wmi-and-the-wbemtest\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;WMI and the WBEMTEST&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sfsi_plus_gutenberg_text_before_share":"","sfsi_plus_gutenberg_show_text_before_share":"","sfsi_plus_gutenberg_icon_type":"","sfsi_plus_gutenberg_icon_alignemt":"","sfsi_plus_gutenburg_max_per_row":"","footnotes":""},"categories":[4,8],"tags":[159,158,160],"class_list":["post-536","post","type-post","status-publish","format-standard","hentry","category-infosec","category-server-administration","tag-wbemtest","tag-wmi","tag-wmimgmt"],"_links":{"self":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/comments?post=536"}],"version-history":[{"count":1,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/536\/revisions"}],"predecessor-version":[{"id":537,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/536\/revisions\/537"}],"wp:attachment":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/media?parent=536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/categories?post=536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/tags?post=536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}