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
1 2 3 4 5 6 7 |
$folders_to_delete = get-childitem -Path SOD:\UserCollection\software | Select-Object name -ExpandProperty name foreach ($folder in $folders_to_delete) { #$folder Remove-Item "SOD:\UserCollection\software\$folder" -Force -Verbose |