{"id":13,"date":"2023-03-21T03:25:45","date_gmt":"2023-03-21T03:25:45","guid":{"rendered":"https:\/\/brunocm.azurewebsites.net\/?page_id=13"},"modified":"2025-10-10T18:44:21","modified_gmt":"2025-10-10T16:44:21","slug":"part-1-a-simple-xml-extension-file","status":"publish","type":"page","link":"https:\/\/brunocm.azurewebsites.net\/?page_id=13","title":{"rendered":"Part 1 &#8211; A simple XML extension file"},"content":{"rendered":"<h1>Create a sample XML extension file to ping a device<\/h1>\n<p><u>Prerequisites :<\/u><br \/>\nTo follow this part, you&#8217;ll need :<\/p>\n<ul>\n<li>A good text editor with XML highlighting feature if possible.<\/li>\n<li>The Configuration Manager SDK<\/li>\n<\/ul>\n<p>First of all, we will have to find a well-hidden information: the GUID of the object we want to attach our menu entry to.<\/p>\n<p>This is one of the &#8220;not so clear&#8221; information provided in the SDK. Each visible item in the console has a unique ID assigned. Take a look in the console installation folder, you will find a subfolder named &#8220;XmlStorage&#8221;.<\/p>\n<p>This is where everything resides. The console definition files are located in the &#8220;ConsoleRoot&#8221; subfolder. Later, we will work in the Extensions subfolder.<\/p>\n<p>Here is the file list of my ConsoleRoot folder:<\/p>\n<pre style=\"padding-left: 30px;\"><strong>AssetManagementNode.xml<\/strong> \nConnectedConsole.xml\nIdleConsole.xml\nIdleNode.xml\nManagementClassDescriptions.xml\n<strong>MonitoringNode.xml\nSiteConfigurationNode.xml\nSoftwareLibraryNode.xml\n<\/strong>ToolsNode.xml<\/pre>\n<p>Names are almost self-explanatory, so open the file you want and start to scout into it!<\/p>\n<p>Don&#8217;t change anything into these files or your console may stop working correctly and you will probably have to re-install it. Working on a copy is advisable.<\/p>\n<p>As you can see, it is not easy to find something in there. So come the second option: internet search! You can easily find some blogs that will list some GUIDs but how reliable these informations are?<\/p>\n<p>My preferred options: use a script to show GUIDs directly in the console. Here is a small PowerShell script that will create a console extension for every single GUID found in a console file.<\/p>\n<p><em><strong>!! Don&#8217;t run this script on a production console !!<\/strong><\/em><\/p>\n<p>Once run you will be able to find easily the required GUIDs but it will highly overload the console!<\/p>\n<p>Here the code of the script:<\/p>\n<pre style=\"width: 690px; height: 690px;\">$consoleXmlList = @(\"AssetManagementNode\",\"SoftwareLibraryNode\")\n\n$cfgmgrpath = Get-ItemPropertyValue -Path \"HKLM:\\SOFTWARE\\WOW6432Node\\Microsoft\\ConfigMgr10\\Setup\" -Name \"UI Installation Directory\"\n\n$nameSpaces=@()\n\n\nforeach($a in $consoleXmlList){\n    Select-Xml -Path \"$cfgmgrpath\\XmlStorage\\ConsoleRoot\\$a.xml\" -XPath \"\/\/*[@NamespaceGuid]\" | ForEach-Object {$nameSpaces+=$_.Node.NamespaceGuid}\n\n}\n\n$nameSpaces|Sort-Object |select -Unique | ForEach {\n    $basefilepath = \"$($cfgmgrpath)XmlStorage\\Extensions\\Actions\"\n    if(!(Test-Path -Path \"$basefilepath\\$_\")){\n    New-Item -Path \"$basefilepath\\$_\" -ItemType Directory\n}\n\n$prefix = $_.substring(0,8)\n\nAdd-Content -Path \"$basefilepath\\$_\\findNS.xml\" -Value \"&lt;ActionDescription Class=\"\"Executable\"\" DisplayName=\"\"$prefix\"\" MnemonicDisplayName=\"\"$prefix\"\" Description=\"\"$prefix\"\"&gt;\"\n\nAdd-Content -Path \"$basefilepath\\$_\\findNS.xml\" -Value \"&lt;ShowOn&gt;&lt;string&gt;ContextMenu&lt;\/string&gt;&lt;string&gt;DefaultHomeTab&lt;\/string&gt;&lt;\/ShowOn&gt;&lt;Executable&gt;&lt;FilePath&gt;c:\\Windows\\notepad.exe&lt;\/FilePath&gt;&lt;\/Executable&gt;&lt;\/ActionDescription&gt;\"\n\n}<\/pre>\n<p>Just modify the first line regarding the workplace(s) you want to work on (filename without extension).<\/p>\n<p>Just as an example, running it as-is on my machine created 1038 extension files.<\/p>\n<p><em>If, later, you want to clean all these files, just search for &#8220;findNS.xml&#8221; files in all Actions subfolders and delete them. To complete the cleaning run the following command with administrator&#8217;s privileges in the Actions subfolder:<\/em><\/p>\n<pre>for \/R %f IN (.) do rmdir \"%f\"<\/pre>\n<p>Now, if you start the console, you will see new entries in every menu you can extend named with the first 6 digits of the corresponding GUID.<\/p>\n<p>In my console, and surely in your console also, there are 2 different GUIDs shown for device contextual menu depending on the context: 3fd01c et ed9dee. A quick look into the &#8220;XmlStorage\\Extension\\Actions\\&#8221; folder informs us that device contextual menu can be extended by placing an XML file into: &#8211; XmlStorage\\Extension\\Actions\\3fd01cd1-9e01-461e-92cd-94866b8d1f39 &#8211; XmlStorage\\Extension\\Actions\\ed9dee86-eadd-4ac8-82a1-7234a4646e62<\/p>\n<p>Let&#8217;s create the file!<\/p>\n<p>Open a new XML file in your favorite editor and place the following lines in it :<\/p>\n<pre>&lt;ActionDescription Class=\"Executable\" DisplayName=\"open a command prompt\" MnemonicDisplayName=\"open a command prompt\" Description=\"just open a new command prompt\"&gt;\n    &lt;ShowOn&gt;\n        &lt;string&gt;ContextMenu&lt;\/string&gt;\n        &lt;string&gt;DefaultHomeTab&lt;\/string&gt;\n    &lt;\/ShowOn&gt;\n    &lt;Executable&gt;\n        &lt;FilePath&gt;C:\\Windows\\System32\\cmd.exe&lt;\/FilePath&gt;\n    &lt;\/Executable&gt;\n&lt;\/ActionDescription&gt;<\/pre>\n<p>Quite simple and self-explanatory. We created a new action (ActionDescription) based on a call of an Executable file (Class=&#8221;Executable&#8221;). Then we informed the engine that we want it visible in the ribbon as in the context menu (cf: &#8220;ShowOn&#8221; section ). Finally, we provided exe file location.<\/p>\n<p>For further detailed information, refer to the SDK documentation.<\/p>\n<p>Name this file as you wish and copy it into the folders we found just before (XmlStorage\\Extension\\Actions\\3fd01cd1\u2026\u2026.). Now restart the console and check that you have a new menu entry when you right-click on a device.<\/p>\n<hr>\n<p>Opening a command prompt, that&#8217;s fine! but let&#8217;s make things a little bit more interesting.<\/p>\n<p>Create a new shortcut to the console executable (Microsoft.ConfigurationManagement.exe) and edit its properties to add &#8220;\/sms:debugview&#8221; option to the command line. This will add a new workplace that will help us to discover object information we can forward to our tool.<\/p>\n<p>Start the console and navigate to Overview\\devices then right-click on an active device and select &#8220;Show Object Details&#8221; menu entry. This will bring you to a new workplace. There, select the &#8220;Properties&#8221; tab to see all available information.<\/p>\n<p>Take a look near the bottom of the list and you&#8217;ll see that the name of the device is available.<br \/>\nNote that the property name is &#8220;Name&#8221;<\/p>\n<p>Then we will modify our XML file as follow:<\/p>\n<pre>\u2026\n    &lt;Executable&gt;\n        &lt;FilePath&gt;C:\\Windows\\System32\\cmd.exe&lt;\/FilePath&gt;\n        <strong><em>&lt;Parameters&gt;\/K ping \"##SUB:Name##\"&lt;\/Parameters&gt;<\/em><\/strong>\n    &lt;\/Executable&gt;\n\u2026<\/pre>\n<p>We add &#8220;\/K&#8221; to launch the ping command but keep the window open after it ends. Then we request the console to provide the &#8220;Name&#8221; Property value to our command.<\/p>\n<p>Almost all properties can be passed as parameters, you only need to surround its name with &#8220;##SUB:&#8221; and &#8220;##&#8221; as in this example.<\/p>\n<p>Of course, adapt the DisplayName and Mnemonic on the first line to reflect the new behavior, save the file, copy it again in the target folders restart the console and try again.<\/p>\n<p>You&#8217;re now able to extend the console with a third party tool or a script of your own!<\/p>\n<p>If you create a script that needs to interact with SCCM infrastructure, 2 specific parameters are available regardless of the object selected: ##SUB:__Server## &amp; ##SUB:__Namespace##.<\/p>\n<p>Be warned that &#8220;__SERVER&#8221; will contains the server name in its short form (no DNS domain name). This may lead to a non-functional tool if the SCCM server is in a DNS zone that is not resolved by users&#8217; workstation.<\/p>\n<p>Now move to next chapter to create you first extension.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Create a sample XML extension file to ping a device Prerequisites : To follow this part, you&#8217;ll need : A good text editor with XML highlighting feature if possible. The Configuration Manager SDK First of all, we will have to find a well-hidden information: the GUID of the object we want to attach our menu &hellip; <a href=\"https:\/\/brunocm.azurewebsites.net\/?page_id=13\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Part 1 &#8211; A simple XML extension file&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":""},"_links":{"self":[{"href":"https:\/\/brunocm.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/pages\/13"}],"collection":[{"href":"https:\/\/brunocm.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/brunocm.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/brunocm.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/brunocm.azurewebsites.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13"}],"version-history":[{"count":1,"href":"https:\/\/brunocm.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/pages\/13\/revisions"}],"predecessor-version":[{"id":95,"href":"https:\/\/brunocm.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/pages\/13\/revisions\/95"}],"wp:attachment":[{"href":"https:\/\/brunocm.azurewebsites.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}