How to find Settings Preventing Application Deletion in ConfigMgr

Today my co-worker was attempting to delete an old application and got blocked with the following message message and I wanted to document it for future reference.

Configuration Manager cannot delete this application because other applications or task sequences reference it or it is configured as a deployment.

Number of Settings = Number of Configuration Items

The first items listed are easy to find and the dialog even provides instructions for finding the blocking references to the application. The last item in the list was the confusing one. Number of settings: 1. There is no information in the dialog to help find out what Settings refers to. To find the answer I opened up smsprov.log from the site server logs to see which query was being run. This is a great technique for finding out where data is coming from within the ConfigMgr console. As you can see in the screenshot, I found the WMI class being queried – SMS_ApplicationLatest.

SMS_ApplicationLatest

To query this in WMI the query would be:

The equivalent query in SQL would use a ConfigMgr SQL function. If you were building a report, you’d want to use the RBAC function fn_rbac_ListLatestApplicationCIs but to keep this simple, we will use the non-RBAC function fn_ListLatestApplicationCIs.

The result of this query includes the NumberOfSettings column which populates the count for Number of settings: in the error message.

fn_ListLatestApplicationCIs – NumberOfSettings

Unfortunately, this function only provides the summarized count for this column, we need the underlying table(s) in order to determine the source of this count.

STOP! The following should only be done in your test/lab environment. I do not recommend doing this in production since you could unintentionally break things. I take no responsibility for your actions.

In SSMS, you can right click on the function and open it in the editor to see what queries are being used to generate the output for the function. This was my next step.

This function is quite complex but searching for NumberOfSettings made it easy to find the source tables in the queries.

Within the console there are Conifiguration Items that go with Configuration Baselines, but within the ConfigMgr backend, Configuration Items can be any object within the database. My next step was to determine what a RelationType of 21 mapped to. I quickly found another view that gave me a full list.

As you can see on line 23, RelationType 21 = AppDCMReference. (Desired Configuration Management) which is part of your Compliance Settings in the for ConfigMgr. You may also notice that RelationType 9 was also used in the query. This was the relationship mapping the Application to the Application Deployment Type. Then the Application Deployment Type was mapped to the Configuration Item.

Building a Query to map Applications to DCM Configuration Items

From there I was able to build a simple query to use to pinpoint the Configuration Item that is preventing the application from being deleted.

In this case, we had to look at the revision history for a CI for another application and delete an older version of the CI where the old application was being referenced. We had created a CI that we used as a template for several others and each time we changed from the template app to the new app, the template app was left in the revision history, making it less than obvious where it was hiding.

Extending the Console

If you want to take it to the next level and add a custom pane to your ConifigMgr console, you can use this WMI query as the starting point then use this great post by Ioan Popovici to buid the custom extension https://sccm-zone.com/extend-the-sccm-console-to-show-collection-membership-using-console-builder-c6db52b408d8. More info on the WMI Class SMS_CIRelation_Flat can be found here https://docs.microsoft.com/en-us/mem/configmgr/develop/reference/compliance/sms_cirelation_flat-server-wmi-class

Summary

Sometimes things within ConfigMgr can be a mystery but with a little bit of digging you can solve the puzzle. If you ever see the message above when deleting an application, just remember that Settings refers to Configuration Items. I hope you found this helpful – if nothing else, I’ve got this documented for the next time I need to deal with it.

No Comments

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

372

Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://dc.services.visualstudio.com/v2/track` resulted in a `400 Invalid instrumentation key` response: {"itemsReceived":1,"itemsAccepted":0,"errors":[{"index":0,"statusCode":400,"message":"Invalid instrumentation key"}]} in /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/application-insights/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113 Stack trace: #0 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/application-insights/vendor/guzzlehttp/guzzle/src/Middleware.php(66): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response)) #1 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/application-insights/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response)) #2 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/application-insights/vendor/guzzlehttp/promises/src/Promise.php(156): Guzzle in /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/application-insights/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113