I'm trying to delete unused user profiles off a terminal services server to gain some free space. However, I can't seem to find a way to delete the AppData folder as I keep getting "Access Denied" errors. I was wondering if anyone had a technique around this issue?
$removefolder = [System.IO.Path]::GetFullPath("\\server1\c$\users\" + $folder.name)
Remove-Item $removefolder -recurse -force
Remove-Item : Access to the path '\server1\c$\users\user1\AppData\Local\Application Data' is denied.