Uninstall all dependant apps in Business Central On-premise

Uninstall all dependent apps

Ever tried to uninstall a Business Central app in PowerShell, and failed due to dependencies on that app? I hit that problem and decided to share a script to detect and uninstall all dependant apps.

I was looking to publish an app from VS Code on a copy of a customers database so I could debug and develop locally and needed to uninstall the app first before I could deploy. The problem was, this app was a dependency for several other apps created for the customer.

What I found is we can get a full list of apps installed with the Get-NavAppInfo cmdlet, then for each app iterate through the dependencies until we find our app:

https://gist.github.com/DanKinsella/b3b4a534fe23204c35affc56b296d3c2.js

The script prints out a list of app names and versions which can be used for reinstalling them after. 

Hope this is useful for someone else.

Comments

2 responses to “Uninstall all dependant apps in Business Central On-premise”

  1. […] post Uninstall all dependant apps in Business Central On-premise appeared first on Dan […]

    Like

  2. […] I was searching for a solution to find all the dependent apps, I came across this blog  ( https://dankinsella.blog/uninstall-all-dependant-apps-in-business-central-on-premise/&nbsp😉 in which author is talking about the script to uninstall all dependent apps, thanks to […]

    Like

Leave a comment