Need to clear Users My Documents folders on terminal server

Richard Gray
Richard Gray used Ask the Experts™
on
We are using a Windows 2012 RDS server which works well. However a number of users are storing their documents in their My Documents folder on the server instead of the correct network folder.
Having backed up the server, is there a way of going through each profile & clearing the My Documents & the Download folders, without having to manually go into each one?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
ste5anSenior Developer

Commented:
Sure, attach the VM's disk to your machine, then you can script it. But how want you decide where the documents should be copied to?
Richard GrayIT & QA Manager

Author

Commented:
I dont actually need to copy them as I have them backed up, I dont know scripting, but I need a scrip to go thru the user profiles on the RDP server & clear those folders
Top Expert 2016
Commented:
create a logoff script to delete the files and they will soon get the idea
You can try this in PowerShell:

rm "C:\Users\*\My Documents\*"
rm "C:\Users\*\Downloads\*"
Richard GrayIT & QA Manager

Author

Commented:
Thanks guys

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial