Good Afternoon
I currently have this Powershell script
$Filedays = "-10" $servers = "SERVER1"
$docpath = "\\$server\C$\Documents and settings" foreach($server in $servers){ $users = Get-ChildItem -exclude 'all users' $docpath } $users | where-object { $_.LastWriteTime -lt (Get-Date).AddDays($FileDays)} | Remove-Item
I aim to run this and that would delete the users profile folder from docs and settings area of the expected server ovr xx days
However when running this i am informed that the folder contains child items and to use -recurse for this to work
When i use the -recurse it takes an age to remove the users folder from the doc and settings area, i want to simply say delete and that's it
Is there a quicker way to delete a folder without it having to manually trawl through and remove each child within? i simply want to permanent delete the folder returned
Any Advice would be appreciated
Barrie