PowerShell Script to delete Collections older than X Days under Specific Folder

Nicolas PilonPowershell, SCCM1 Comment

Did you ever wanted to delete a bunch of collections older than x days under specific folder name? I recently needed to clean collections older than 7 days under specific folders. The reason was simple, I came across a situation where the company own a custom package deployment solution and it create a collection each time a deployment is made. Since they are all limited collections, you can imagine the load it can create for the collection evaluator. The best solution would be to delete the collection as soon the deployment is succeeded,┬ásome internal politics prevents us to do that. Instead of doing it one by one, I decided to create an automate PowerShell script that run each week. The PowerShell script create a small report in a text file including the list of collections ID deleted. The file will be sent by email as an attachment and will be … Read More