If you have a folder-structure in ConfigMgr and you need to remove the folders (if they are empty) and you tried to right-click and select remove…you noticed that it takes….looooong time to remove….
The following script removes all folders under “UserCollections\software
$folders_to_delete = get-childitem -Path SOD:\UserCollection\software | Select-Object name -ExpandProperty name
foreach ($folder in $folders_to_delete)
Remove-Item "SOD:\UserCollection\software\$folder" -Force -Verbose