The number of apps that come with a standard container has exploded over the past handful of releases. My local setup involves doing development in Hyper-V virtual machines, so local system resources are at a premium. It is very easy to trim the fat so to speak, so read on if you want to know how.
What’s with these apps?
From foreign languages to IRS reports. From integration and migration tools to email functionality and even connectors to external systems like the Spotify app. Having these in separate apps is great, because it is very easy to get rid of them.
The downside is that each app comes with its own set of table extensions, which are implemented as companion tables. Each time that a database action is taken against the main table, the system also has to maintain each companion table. Multiply this issue with the number of companies in your system and you can imagine the performance hit this could take.
Funny as it seems if you know what my desk looks like, but I HATE clutter in the extension list, especially if it is functionality that I just don’t ever use. I will NEVER have a need to use the Norwegian language, nor will I EVER need to use the Paypal links in a local container. In other words, I will never need to use the vast majority of these apps. Most importantly though I had started noticing a real slowing down of the performance in my local containers. I had even started wondering if it is time to replace my machine.
Get rid of these apps!
Lucky for us, it is VERY easy to get rid of apps. The BCContainerHelper module has two commands for you. One is UnInstall-BcContainerApp, which we will use in today’s post. The second one is UnPublish-BcContainerApp, which is useful in case you want to completely get rid of the app altogether. If you want to be a real ninja about it, follow the links to see the underlying PowerShell logic that you can use for inspiration. Me, I like to keep it simple, so I’ll use the BCContainerHelper Cmdlets.
If you were thinking ‘never say never’ when you were reading the previous paragraph, you were absolutely right. What if I get a Norwegian customer tomorrow? Let’s use the uninstall Cmdlet. This will leave the app in the system, ready to be installed again at a later date
UnInstall-BcContainerApp ` -containerName 'MyContainer' ` -name 'Shopify Connector' ` -doNotSaveData ` -doNotSaveSchema ` -force
- The name of the app is enough to uninstall the app. You could also specify the publisher and version if you want but for our purposes the name is enough since all apps in the standard container are published by Microsoft
- The ‘doNotSaveData’ parameter is used to make sure that the data is deleted from the companion tables, important because we are going to get rid of those with the next parameter
- The ‘doNotSaveSchema’ parameter is used to remove the companion tables from the system. If you do not set this parameter, the schema will remain in the app database
If you are absolutely certain that you will never use the app, you can use the UnPublish Cmdlet instead and REALLY clean up that app list.
Bonus Company Removal
The standard container also comes with a pre-configured company called ‘My Company’ that I personally never use, and we have a command to remove that too:
Remove-CompanyInBcContainer ` -containerName 'MyContainer' ` -companyName 'My Company'
Get rid of half the companies, get rid of 50% of the unnecessary companion tables.
Put it All Together
In my personal ‘arsenal’ of goodies, I keep a set of scripts to create new containers. One of those is a script called ‘RemoveBloatware.ps1’ that lists just about every app in the standard container, something like this:
$MyContainerName = 'MyContainer' Remove-CompanyInBcContainer ` -containerName $MyContainerName ` -companyName 'My Company' UnInstall-BcContainerApp ` -containerName $MyContainerName ` -name 'AMC Banking 365 Fundamentals' ` -doNotSaveData ` -doNotSaveSchema ` -force UnInstall-BcContainerApp ` -containerName $MyContainerName ` -name 'Business Central Cloud Migration - Previous Release' ` -doNotSaveData ` -doNotSaveSchema ` -force UnInstall-BcContainerApp ` -containerName $MyContainerName ` -name 'Business Central Cloud Migration - Previous Release (US)' ` -doNotSaveData ` -doNotSaveSchema ` -force UnInstall-BcContainerApp ` -containerName $MyContainerName ` -name 'Shopify Connector' ` -doNotSaveData ` -doNotSaveSchema ` -force # etcetera, add any app that you don't want
Now you can call this script from your NewContainer script and have a nicely trimmed container. It made a real difference for me, I can really notice the better performance. Very useful when you’re in the thick of coding and you need to deploy code changes frequently.