Forum Discussion
eyalmargani
Nov 03, 2022Copper Contributor
DELETE USERS FILES FROM USER PROFILE BY GPO
hello , in my organization i need to delete all user's profiles files. i tried to it by gpo with the cmd script::del /f d:\user\%USERNAME%\documents\*.* del /f d:\user\%USERNAME%\Videos\*.* del ...
Leavii
Nov 03, 2022Brass Contributor
eyalmargani You need to specify /q along with /f. I have tested the following and it works fine. Make sure your paths are correct, and the GPO is under User Configuration.
del /q /f /s %userprofile%\downloads\*
eyalmargani
Nov 09, 2022Copper Contributor
tnx for the answer .
does the specific user have an admin permissions?
does the specific user have an admin permissions?
- LeaviiNov 09, 2022Brass Contributor
For my test no, the user was not an admin.
- eyalmarganiNov 10, 2022Copper Contributori write the following script :
del /q /f /s d:\user\%userprofile%\documents\*
del /q /f /s d:\user\%userprofile%\Videos\*
del /q /f /s d:\user\%userprofile%\Pictures\*
del /q /f /s d:\user\%userprofile%\Music\*
del /q /f /s d:\user\%userprofile%\Desktop\*
del /q /f /s d:\user\%userprofile%\Downloads\*
as i wrote before the user profile folder is at drive d.
it stil doesnt work.
any ideas?- Impie1080Jul 20, 2023Copper Contributor
eyalmargani there seems to be a mistake in the paths. The %userprofile% environment variable should not be used with d:\user, as %userprofile% already contains the full path
del /q /f /s "%userprofile%\Documents\*"
del /q /f /s "%userprofile%\Videos\*"
del /q /f /s "%userprofile%\Pictures\*"
del /q /f /s "%userprofile%\Music\*"
del /q /f /s "%userprofile%\Desktop\*"
del /q /f /s "%userprofile%\Downloads\*"