Forum Discussion

koakenred's avatar
koakenred
Copper Contributor
Mar 28, 2020

Intune Policy for automatically emptying downloads Folder

Hi i am new to Microsoft Intune. I am looking for way to automatically empty the download folder when a user logs out. I previously had a powershell script that had to be configured on every workstation in order to empty this downloads folder when a user logs out. Is there a way  to configure this in Microsoft Intune?

4 Replies

  • Thijs Lecomte's avatar
    Thijs Lecomte
    Bronze Contributor

    Hi 

    koakenred 

     

    I wouldn't create a specific Powershell script, but utilize a built-in feature from Windows 10, called Storage Sense.

     

    Storage Sense can automatically cleanup certain unused files and also files in the Downloads.

    check out this blog for more information:

    https://www.petervanderwoude.nl/post/configure-storage-sense-via-windows-10-mdm/

     

    You are looking for the 'ConfigStorageSenseDownloadsCleanupThreshold' setting. If you put that at '1', all downloads are deleted after one day of not being opened.

    • KnightOfNerd's avatar
      KnightOfNerd
      Copper Contributor
      This is really helpful, however, can this be used for the exact use case i.e. clear downloads on each logout?
      • Thijs Lecomte's avatar
        Thijs Lecomte
        Bronze Contributor
        There is no built-in way to do this. You would have to create a scheduled task through Intune to do this
  • Moe_Kinani's avatar
    Moe_Kinani
    Bronze Contributor
    I think it’s possible using Intune PowerShell. I have not used the script below but it may work for your situation.


    Hope this helps!
    Moe

    https://www.lieben.nu/liebensraum/2019/06/simplify-logon-scripts-in-intune-without-schedules/

    https://gitlab.com/Lieben/assortedFunctions/blob/master/invoke-asIntuneLogonScript.ps1

Resources