Forum Discussion

eyalmargani's avatar
eyalmargani
Copper Contributor
Nov 03, 2022

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 /f d:\user\%USERNAME%Pictures\*.*
del /f d:\user\%USERNAME%\Music\*.*
del /f d:\user\%USERNAME%\Desktop\*.*
del /f d:\user\%USERNAME%\Downloads\*.*

unfortunatly its not working.

do you have another way to do so ?

thanks.

 

  • Leavii's avatar
    Leavii
    Brass 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's avatar
      eyalmargani
      Copper Contributor
      tnx for the answer .
      does the specific user have an admin permissions?
      • Leavii's avatar
        Leavii
        Brass Contributor

        For my test no, the user was not an admin.

Resources