I had a lot of software at a costumer which needed to be uninstalled automatically because of expensive licencing. I stumbled upon this article from systemcenterdudes where Nicolas Pilon have created queries and collections in SCCM containing exactly what i needed. Based on that article i created a powershell script to do that for me.