Clearing Outlook temp files folder (OLK*) on shutdown?

Discussion in 'Scripting' started by Barkley Bees, Feb 15, 2008.

  1. Barkley Bees

    Barkley Bees Guest

    Trying to find the best way to have XP client PC's clear their Outlook 2003
    temporary folder data on system shutdown (C:\Documents and
    Settings\%userprofile%\Local Settings\Temporary Internet Files\OLK*). Can
    this be accomplished using Group Policy to set the "shutdown script" and use
    something like the below in a .bat file:
     
    Barkley Bees, Feb 15, 2008
    #1
    1. Advertisements

  2. Barkley Bees

    Barkley Bees Guest

    Perhaps I should rephrase my question: can a .bat file be caused for a
    shutdown script applied via Group policy or does it need to be in another
    fromat (vb, etc)?

    I have the following I plan to use:
    ----------------------------------------------------------------------------------------
    @echo off
    rem Delete Outlook 2003 temporary files on client Machines

    if exist "%userprofile%\Local Settings\Temporary Internet Files\OLK*" (cd
    "%userprofile%\Local Settings\Temporary Internet Files\OLK*") else (goto
    END)
    del *.* /s /f /q
    goto END
    :END
     
    Barkley Bees, Feb 15, 2008
    #2
    1. Advertisements

  3. What makes you think that OLK files reside here:
    %userprofile%\Local Settings\Temporary Internet Files\OLK*?
    Why do you want to delete such files?

    The script you use is highly lethal: If the target folder you specify
    does not exist then it will wipe just about everything on your disk!

    As it happens, there is no folder called
    %userprofile%\Local Settings\Temporary Internet Files\OLK*
    hence your Windows installation will cease to exist when you
    first run your batch file. Furthermore, although it is not strictly
    necessary for the "CD" command, you should always surround
    your file/folder names with double quotes if they might contain
    embedded spaces. %UserProfile% does contain embedded
    spaces.
     
    Pegasus \(MVP\), Feb 15, 2008
    #3
  4. Barkley Bees

    Callypso Guest

    You can use BAT files as shutdown script, that's no problem.

    for more information see
    http://technet2.microsoft.com/windo...c165-49e3-b768-2b8898a5684b1033.mspx?mfr=true

    In addition to that I would suggest you use the following line to clear out
    temporary internet files. This will include the OLK folder and is what I use
    in our network

    ERASE C:\"Documents and Settings"\%USERNAME%\"Local Settings"\"Temporary
    Internet Files"\*.* /q /f /s


    Callypso
    Network Engineer
     
    Callypso, Feb 15, 2008
    #4
  5. As mentioned, this won't work if that isn't the location - and the location
    can vary. The commands above could do Very Scary Things to your computer.

    See
    http://www.groovypost.com/howto/microsoft/outlook/find-the-microsoft-outlook-temporary-olk-folder/
    for info on Outlook's temp folder.

    Presuming Outlook is using the normal/defaults, which are indeed in a
    subfolder under temp internet files, why not delete *all* your Internet
    cache files via a shutdown script? I have the following batch file running
    as a GPO-applied shutdown script in most of the networks I support....I
    cribbed it shamelessly from some nice stranger on the internet.
     
    Lanwench [MVP - Exchange], Feb 17, 2008
    #5
  6. Barkley Bees

    Barkley Bees Guest

    Thanks for your reply Lanwench. I agree with the potential dangers here. We
    do use a standard image which guarantees everyone has the same path but
    still, you never know.

    The problem is that our management doesn't want to delete the temporary
    internet files, only the Outlook temp files. I will see what pushing I can
    do though =). The script you posted below, was this saved as a .bat and
    assigned as the shutdown script?


    "Lanwench [MVP - Exchange]"
     
    Barkley Bees, Feb 18, 2008
    #6
  7. What on earth do they think "temporary" is supposed to mean?
    Yep. I'm sure you can massage it to do only the OL folder, but my heavens,
    I'd discuss this with management. Or, in the case of the networks I support,
    I would simply run my shutdown script with no discussion. I don't believe in
    giving pointy-haired bosses too much information. :)
     
    Lanwench [MVP - Exchange], Feb 19, 2008
    #7
  8. Barkley Bees

    Al Dunbar Guest

    We did much the same, but on a user-by-user basis, and ran it as a logoff
    script. Rather than deleting all files in all contained folders (while
    leaving the folders in existence) we simply deleted the OLK folder. A new
    one is then created the next time the user runs outlook. We also deduced its
    actual name from the registry rather than resolving it from dir OLK*, but I
    guess either way would be OK.

    /Al
     
    Al Dunbar, Nov 21, 2008
    #8
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.