Script queries SCCM database to find applications, which have been created during last few days. Then finds the collections, to which the corresponding superseded applications have been deployed to.
The script is part of a bit bigger project, where I wanted to automate the deployment of the application updates. I needed info, to which collections new application must be deployed to, based on what collections previous version was deployed to. This data can be used to create new deployments via New-CMApplicationDeployment.