{"id":4528,"date":"2010-07-28T09:13:00","date_gmt":"2010-07-28T09:13:00","guid":{"rendered":"https:\/\/www.sotec.eu\/?p=4528"},"modified":"2025-09-04T12:48:45","modified_gmt":"2025-09-04T12:48:45","slug":"scom-mps-nicks-and-nags-of-registry-discoveries","status":"publish","type":"post","link":"https:\/\/www.sotec.eu\/en\/scom-mps-nicks-and-nags-of-registry-discoveries\/","title":{"rendered":"SCOM MPs: Nicks and Nags of registry discoveries"},"content":{"rendered":"\n<p>For better monitoring of software SOTEC provides management packs for System Center Operations Management (SCOM) from Microsoft. In addition to our own products we also author management packs for existing third party software. However authoring those management packs can be tricky at times.<\/p>\n\n\n\n<p>Recently I ran into a problem with my usual way of writing a discovery. My prefered way to discover an installed application was to query the registry for the right value. An example of the discovery script (VBScript) is shown below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SourceId = WScript.Arguments(0)\nManagedEntityId = WScript.Arguments(1)\nsComputerName = WScript.Arguments(2)\nconst HKEY_LOCAL_MACHINE = &amp;H80000002\nSet oAPI = CreateObject(\"MOM.ScriptAPI\")\nSet oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)\nSet oReg=GetObject(\"winmgmts:{impersonationLevel=impersonate}!\\\\\" &amp; sComputerName &amp; \"\\root\\default:StdRegProv\")\nconst strKeyPath = \"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\"\nconst strValueName = \"DisplayName\"\nconst strValue = \"Application Name\"\noReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys\ndim count\ncount = 1\nFor Each subkey In arrSubKeys\nstrKeyPathNew = strKeyPath &amp; \"\\\" &amp; subkey\nret = oReg.GetStringValue(HKEY_LOCAL_MACHINE,strKeyPathNew,strValueName,displayName)\nIf (ret = 0) Then\nif (InStr(displayName,strValue) > 0) Then\n' get version\nret = oReg.GetStringValue(HKEY_LOCAL_MACHINE,strKeyPathNew,\"DisplayVersion\",displayVersion)\nif (ret = 0) Then\nSet oInstance = oDiscoveryData.CreateClassInstance(\"$MPElement&#91;Name='MP.Object.Name']$\")\noInstance.AddProperty \"$MPElement&#91;Name='Windows!Microsoft.Windows.Computer']\/PrincipalName$\",\nsComputerName\noInstance.AddProperty \"$MPElement&#91;Name='MP.Object.Name']\/Version$\", displayVersion\noDiscoveryData.AddInstance(oInstance)\nEnd If\nEnd If\nElse\nErr.Clear\nEnd If\nNext\noAPI.Return(oDiscoveryData)<\/code><\/pre>\n\n\n\n<p>However this method of discovery proved to be unreliable when you\u2019re monitoring applications in an environment where you have Windows Vista and Windows 7 in use. The registry values of the installed software seems to be randomly distributed in the Keys for 64Bit and 32Bit for these operation systems. Instead of searching the subkeys for each architechture I decided to use the WMI (Windows Management Interface). To be more flexible with the discovery I wrapped it into VBScript. You can see an example of the new discovery script below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SourceId = WScript.Arguments(0)\nManagedEntityId = WScript.Arguments(1)\nsComputerName = WScript.Arguments(2)\n\nSet oAPI = CreateObject(\"MOM.ScriptAPI\")\nSet oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)\n\nstrSoftwareName = \"\"\"Software Name\"\"\"\nSet objWMIService = GetObject(\"winmgmts{impersonationLevel=impersonate}!\\\\\" &amp; sComputerName &amp; \"\\root\\cimv2\")\nSet colSoftware = objWMIService.ExecQuery(\"Select * from Win32_Product WHERE Name = \" &amp; strSoftwareName)\nFor Each objItem in colSoftware\nSet oInstance = oDiscoveryData.CreateClassInstance(\"$MPElement&#91;Name='MP.Object.Name']$\")\nWith oInstance\n.AddProperty \"$MPElement&#91;Name='Windows!Microsoft.Windows.Computer']\/PrincipalName$\", sComputerName\n.AddProperty \"$MPElement&#91;Name='MP.Object.Name']\/Version$\", objItem.Version\nEnd With\noDiscoveryData.AddInstance(oInstance)\nNextoAPI.Return(oDiscoveryData)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>For better monitoring of software SOTEC provides management packs for System Center Operations Management (SCOM) from Microsoft. In addition to our own products we also author management packs for existing third party software. However authoring those management packs can be tricky at times.<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4528","post","type-post","status-publish","format-standard","hentry","category-nicht-kategorisiert"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SCOM MPs: Nicks and Nags of registry discoveries - SOTEC<\/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:\/\/www.sotec.eu\/scom-mps-nicks-and-nags-of-registry-discoveries\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SCOM MPs: Nicks and Nags of registry discoveries - SOTEC\" \/>\n<meta property=\"og:description\" content=\"For better monitoring of software SOTEC provides management packs for System Center Operations Management (SCOM) from Microsoft. In addition to our own products we also author management packs for existing third party software. However authoring those management packs can be tricky at times.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sotec.eu\/scom-mps-nicks-and-nags-of-registry-discoveries\/\" \/>\n<meta property=\"og:site_name\" content=\"SOTEC\" \/>\n<meta property=\"article:published_time\" content=\"2010-07-28T09:13:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-04T12:48:45+00:00\" \/>\n<meta name=\"author\" content=\"Anna Akinchyna\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Anna Akinchyna\" \/>\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:\\\/\\\/www.sotec.eu\\\/scom-mps-nicks-and-nags-of-registry-discoveries\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/scom-mps-nicks-and-nags-of-registry-discoveries\\\/\"},\"author\":{\"name\":\"Anna Akinchyna\",\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/#\\\/schema\\\/person\\\/07cb9b84a952982037f22f56d491df03\"},\"headline\":\"SCOM MPs: Nicks and Nags of registry discoveries\",\"datePublished\":\"2010-07-28T09:13:00+00:00\",\"dateModified\":\"2025-09-04T12:48:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/scom-mps-nicks-and-nags-of-registry-discoveries\\\/\"},\"wordCount\":181,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/#organization\"},\"articleSection\":[\"Nicht kategorisiert\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.sotec.eu\\\/scom-mps-nicks-and-nags-of-registry-discoveries\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/scom-mps-nicks-and-nags-of-registry-discoveries\\\/\",\"url\":\"https:\\\/\\\/www.sotec.eu\\\/scom-mps-nicks-and-nags-of-registry-discoveries\\\/\",\"name\":\"SCOM MPs: Nicks and Nags of registry discoveries - SOTEC\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/#website\"},\"datePublished\":\"2010-07-28T09:13:00+00:00\",\"dateModified\":\"2025-09-04T12:48:45+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/scom-mps-nicks-and-nags-of-registry-discoveries\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.sotec.eu\\\/scom-mps-nicks-and-nags-of-registry-discoveries\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/scom-mps-nicks-and-nags-of-registry-discoveries\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SCOM MPs: Nicks and Nags of registry discoveries\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/#website\",\"url\":\"https:\\\/\\\/www.sotec.eu\\\/\",\"name\":\"SOTEC\",\"description\":\"Engineering for Digital Transformation\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.sotec.eu\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/#organization\",\"name\":\"SOTEC\",\"url\":\"https:\\\/\\\/www.sotec.eu\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.sotec.eu\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/logo-en-raster-1-scaled.png\",\"contentUrl\":\"https:\\\/\\\/www.sotec.eu\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/logo-en-raster-1-scaled.png\",\"width\":2560,\"height\":634,\"caption\":\"SOTEC\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.sotec.eu\\\/#\\\/schema\\\/person\\\/07cb9b84a952982037f22f56d491df03\",\"name\":\"Anna Akinchyna\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/aa135b4d99d22de7eb18b5a8aad37e4346b806b5e6ac52e75ab2706cf48ebe7d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/aa135b4d99d22de7eb18b5a8aad37e4346b806b5e6ac52e75ab2706cf48ebe7d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/aa135b4d99d22de7eb18b5a8aad37e4346b806b5e6ac52e75ab2706cf48ebe7d?s=96&d=mm&r=g\",\"caption\":\"Anna Akinchyna\"},\"url\":\"https:\\\/\\\/www.sotec.eu\\\/en\\\/author\\\/a-akinchynasotec-eu\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SCOM MPs: Nicks and Nags of registry discoveries - SOTEC","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:\/\/www.sotec.eu\/scom-mps-nicks-and-nags-of-registry-discoveries\/","og_locale":"en_US","og_type":"article","og_title":"SCOM MPs: Nicks and Nags of registry discoveries - SOTEC","og_description":"For better monitoring of software SOTEC provides management packs for System Center Operations Management (SCOM) from Microsoft. In addition to our own products we also author management packs for existing third party software. However authoring those management packs can be tricky at times.","og_url":"https:\/\/www.sotec.eu\/scom-mps-nicks-and-nags-of-registry-discoveries\/","og_site_name":"SOTEC","article_published_time":"2010-07-28T09:13:00+00:00","article_modified_time":"2025-09-04T12:48:45+00:00","author":"Anna Akinchyna","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Anna Akinchyna","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.sotec.eu\/scom-mps-nicks-and-nags-of-registry-discoveries\/#article","isPartOf":{"@id":"https:\/\/www.sotec.eu\/scom-mps-nicks-and-nags-of-registry-discoveries\/"},"author":{"name":"Anna Akinchyna","@id":"https:\/\/www.sotec.eu\/#\/schema\/person\/07cb9b84a952982037f22f56d491df03"},"headline":"SCOM MPs: Nicks and Nags of registry discoveries","datePublished":"2010-07-28T09:13:00+00:00","dateModified":"2025-09-04T12:48:45+00:00","mainEntityOfPage":{"@id":"https:\/\/www.sotec.eu\/scom-mps-nicks-and-nags-of-registry-discoveries\/"},"wordCount":181,"commentCount":0,"publisher":{"@id":"https:\/\/www.sotec.eu\/#organization"},"articleSection":["Nicht kategorisiert"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.sotec.eu\/scom-mps-nicks-and-nags-of-registry-discoveries\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.sotec.eu\/scom-mps-nicks-and-nags-of-registry-discoveries\/","url":"https:\/\/www.sotec.eu\/scom-mps-nicks-and-nags-of-registry-discoveries\/","name":"SCOM MPs: Nicks and Nags of registry discoveries - SOTEC","isPartOf":{"@id":"https:\/\/www.sotec.eu\/#website"},"datePublished":"2010-07-28T09:13:00+00:00","dateModified":"2025-09-04T12:48:45+00:00","breadcrumb":{"@id":"https:\/\/www.sotec.eu\/scom-mps-nicks-and-nags-of-registry-discoveries\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sotec.eu\/scom-mps-nicks-and-nags-of-registry-discoveries\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sotec.eu\/scom-mps-nicks-and-nags-of-registry-discoveries\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/www.sotec.eu\/en\/"},{"@type":"ListItem","position":2,"name":"SCOM MPs: Nicks and Nags of registry discoveries"}]},{"@type":"WebSite","@id":"https:\/\/www.sotec.eu\/#website","url":"https:\/\/www.sotec.eu\/","name":"SOTEC","description":"Engineering for Digital Transformation","publisher":{"@id":"https:\/\/www.sotec.eu\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sotec.eu\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.sotec.eu\/#organization","name":"SOTEC","url":"https:\/\/www.sotec.eu\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sotec.eu\/#\/schema\/logo\/image\/","url":"https:\/\/www.sotec.eu\/wp-content\/uploads\/2024\/11\/logo-en-raster-1-scaled.png","contentUrl":"https:\/\/www.sotec.eu\/wp-content\/uploads\/2024\/11\/logo-en-raster-1-scaled.png","width":2560,"height":634,"caption":"SOTEC"},"image":{"@id":"https:\/\/www.sotec.eu\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.sotec.eu\/#\/schema\/person\/07cb9b84a952982037f22f56d491df03","name":"Anna Akinchyna","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/aa135b4d99d22de7eb18b5a8aad37e4346b806b5e6ac52e75ab2706cf48ebe7d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/aa135b4d99d22de7eb18b5a8aad37e4346b806b5e6ac52e75ab2706cf48ebe7d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/aa135b4d99d22de7eb18b5a8aad37e4346b806b5e6ac52e75ab2706cf48ebe7d?s=96&d=mm&r=g","caption":"Anna Akinchyna"},"url":"https:\/\/www.sotec.eu\/en\/author\/a-akinchynasotec-eu\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/posts\/4528","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/comments?post=4528"}],"version-history":[{"count":1,"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/posts\/4528\/revisions"}],"predecessor-version":[{"id":4529,"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/posts\/4528\/revisions\/4529"}],"wp:attachment":[{"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/media?parent=4528"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/categories?post=4528"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sotec.eu\/en\/wp-json\/wp\/v2\/tags?post=4528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}