One of the cool things about ConfigMgr is that you can add in your own tools as right click menu items. There are some really good ones out there. In my environment, I have some GUI tools I have for boundary and collection creation that are used to enforce naming standards as well as perform additional steps to help eliminate human error. I recently decided that I would like to leverage this function to open up ConfigMgr reports and pass the parameters from the console to the report.
Determine report URL
The first thing I did was figure out what report I wanted to use and get the URL. I am going to actually change the format of the URL and make some additions to pass the parameter with the URL.
Here is my URL:
http://reportsvr/Reports/report/ConfigMgr_ABC/Count_Client_Versions_by_Collection
Determine report parameter(s)
Unless you already know the name of the parameter (and I rarely do and I need to standardize my naming), open the report up in Report Builder and expand Parameters. This gives you the name of the parameter. You may also need to look over the query used so you know what the parameter is looking for.
In my case the parameter is COLLID and it is looking for the CollectionID.
Determine where in console to have right click report show
This is where the fun starts. You need figure out the GUID of the menu that you want to add to and this is best done with a script that will automatically display those GUIDs.
I used the script at https://www.ephingadmin.com/create-your-own-right-click-tools/ to show the GUIDs when I right click in the console. That is also where I learned how to make custom right click tools from so it is a good read as I will be repeating info from it.
Here are the common ones I use though
Right click on… | GUID |
Collection | a92615d6-9df3-49ba-a8c9-6ecb0e8b956b |
Device | 3fd01cd1-9e01-461e-92cd-94866b8d1f39 |
Package Deployment | adab1364-cf7d-4b07-8863-e9252e506e62 |
Application Deployment | 9a0e2197-51a4-439d-99ea-67edc451a51e |
For my report, I see that the GUID is a92615d6-9df3-49ba-a8c9-6ecb0e8b956b
Determine what data can be pulled from console to set parameter
Once I have the GUID, I need find the WQL query used with it to make sure it actually pulls the data I need to pass to the parameter.
There is an XML for each Node under \AdminConsole\XmlStorage\ConsoleRoot in the directory your console is installed under. I found a92615d6-9df3-49ba-a8c9-6ecb0e8b956b in AssetManagementNode.xml and it uses SMS_Collection.
A quick search on SMS_Collection gets me this list of possible data I can pass to my report parameter.
Class SMS_Collection : SMS_BaseClass
{
String CollectionID;
SMS_CollectionRule CollectionRules[];
UInt32 CollectionType;
SInt32 CollectionVariablesCount;
String Comment;
UInt32 CurrentStatus;
Boolean HasProvisionedMember;
SInt32 IncludeExcludeCollectionsCount;
Boolean IsBuiltIn;
Boolean IsReferenceCollection;
UInt8 ISVData[];
UInt32 ISVDataSize;
String ISVString;
DateTime LastChangeTime;
DateTime LastMemberChangeTime;
DateTime LastRefreshTime;
String LimitToCollectionID;
String LimitToCollectionName;
SInt32 LocalMemberCount;
String MemberClassName;
SInt32 MemberCount;
UInt32 MonitoringFlags;
String Name;
Boolean OwnedByThisSite;
SInt32 PowerConfigsCount;
SMS_ScheduleToken RefreshSchedule[];
UInt32 RefreshType;
Boolean ReplicateToSubSites;
SInt32 ServiceWindowsCount;
Boolean UseCluster;
};
CollectionID is what I need to pass to the parameter and I see that it is included with SMS_Collection.
Formatting URL to pass parameter
In order to include the parameter with report URL, I need to alter the URL. Unfortunately, I do not remember where I learned this as I would link to it. Basically, the URL needs to be changed to reference the use of ReportViewer.aspx.
Here is the URL before and after the change
http://reportsvr/Reports/report/ConfigMgr_ABC/Count_Client_Versions_by_Collection
http://reportsvr/ReportServer/Pages/ReportViewer.aspx?/ConfigMgr_ABC/ Count_Client_Versions_by_Collection
We now need to add the command the render to the URL ( &rs:Command=Render )
http://reportsvr/ReportServer/Pages/ReportViewer.aspx?/ConfigMgr_ABC/ Count_Client_Versions_by_Collection&rs:Command=Render
The last part of the new URL is the parameter. The format is {ParameterNameFromReport]=##SUB:[ParameterFromConsole]##
This is the final URL
http://reportsvr/ReportServer/Pages/ReportViewer.aspx?/ConfigMgr_ABC/ Count_Client_Versions_by_Collection&rs:Command=Render&CollID=##SUB:CollectionID##
Creating and placing XML file
The final step is to create and place the XML file. Here is the XML.
<ShowOn>
<string>ContextMenu</string>
</ShowOn>
<ActionGroups>
<ActionDescription Class ="Executable" DisplayName="Client Versions" MnemonicDisplayName="Client Versions">
<ShowOn>
<string>ContextMenu</string>
</ShowOn>
<ImagesDescription>
<ResourceAssembly>
<Assembly>AdminUI.UIResources.dll</Assembly>
<Type>Microsoft.ConfigurationManagement.AdminConsole.UIResources.Properties.Resources.resources</Type>
</ResourceAssembly>
<ImageResourceName>Add</ImageResourceName>
</ImagesDescription>
<Executable>
<FilePath>"C:\Program Files\internet explorer\iexplore.exe"</FilePath>
<Parameters>http://reportsvr/reportserver?/ConfigMgr_ABC/Count_Client_Versions_by_Collection&rs:Command=Render&COLLID=##SUB:CollectionID##</Parameters>
</Executable>
</ActionDescription>
</ActionGroups>
</ActionDescription>
I then copy the XML file into the appropriate folder for the GUID
C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\XmlStorage\Extensions\Actions\a92615d6-9df3-49ba-a8c9-6ecb0e8b956b