Welcome › Forums › General PowerShell Q&A › Remove-Item in use by another process
This topic contains 2 replies, has 2 voices, and was last updated by
I am trying to delete users' home folders who no longer have an AD account. I found that Remove-Item only works properly if you use Get-ChildItem first and pipe it to Remove-Item.
This is the command I am using:
Get-ChildItem c:\whatever -Recurse -force | Remove-Item -force -recurse -Confirm:$true
It properly deletes the folder contents (including Favorites), but it does not delete the folder itself. I then try to delete it using Remove-Item but it says the folder is being used by another process.
Does anyone know how to get around this issue?
Was the profile recently created? Some windows service might be processing it.
Thanks I found out that was an apache process 🙁
The topic ‘Remove-Item in use by another process’ is closed to new replies.