GPO to delete files from a local PC folder

Posted on 2011-10-26
Last Modified: 2012-05-12
Hello, I cant seem to find what I am trying to acheive (it may not be possible) I have a line of business application that creates temporary files on the local PC on my SBS 2011 network. Previously on SBS 2003 I had a login script run that would delete these temporary files.

I am trying to replicate this function using a GPO is this possible?
Question by:infradatel

    Accepted Solution

    Doh I have just found out how to do it

    Author Closing Comment

    Stupid Question
    LVL 20

    Expert Comment

    by:Hendrik Wiese
    As far as I know this can only be done using a script.

    So you can add the following script into your GPO under User Configuration > Policies > Windows Settings > Script (Logon/Logoff)

    Script: Just replace the *.FileExtension with the extension of the files that you would like to delete.
    Dim fso
    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.DeleteFile "C:\path\to\folder\[b]*.FileExtension[/b]", True 

    Open in new window

    LVL 20

    Expert Comment

    by:Hendrik Wiese
    hahah...refresh :) please post your solution for future users.

    Author Comment

    If you go to Group Policy Management Editor you can obviously create a new GPO or edit an existing one.

    User Config - Preferences - Windows Settings - Folders

    Then create a new task to deltete folders and specify the path.
    LVL 20

    Expert Comment

    by:Hendrik Wiese
    Thanks!! :)

    Featured Post

    The problems with reply email signatures

    Do you wish that you could place an email signature under a reply? Well, unfortunately, you can't. That great Exchange/Office 365 signature you've created will just appear at the bottom of an email chain. What a pain! Is there really no way to solve this? Well, there might be...

    Join & Write a Comment

    Scenario:  You do full backups to a internal hard drive in either product (SBS or Server 2008).  All goes well for a very long time.  One day, backups begin to fail with a message that the disk is full.  Your disk contains many, many more backups th…
    New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
    This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
    This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now