Results 1 to 11 of 11

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

  1. #1
    Barkley Bees Guest

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

    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:

    --------------------------------------------------------------------------------
    cd %userprofile%\Local Settings\Temporary Internet Files\OLK*
    del *.* /s /f /q
    --------------------------------------------------------------------------------

    Can a .bat file be assigned as a 'shutdown script' via group policy?
    Appreciate any feedback or optional advice. Thank you.



  2. #2
    Barkley Bees Guest

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

    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" <barkbees@nomail.com> wrote in message
    news:uppFNQ5bIHA.1208@TK2MSFTNGP03.phx.gbl...
    > 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:
    >
    > --------------------------------------------------------------------------------
    > cd %userprofile%\Local Settings\Temporary Internet Files\OLK*
    > del *.* /s /f /q
    > --------------------------------------------------------------------------------
    >
    > Can a .bat file be assigned as a 'shutdown script' via group policy?
    > Appreciate any feedback or optional advice. Thank you.
    >




  3. #3
    Pegasus \(MVP\) Guest

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


    "Barkley Bees" <barkbees@nomail.com> wrote in message
    news:uppFNQ5bIHA.1208@TK2MSFTNGP03.phx.gbl...
    > 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:
    >
    > --------------------------------------------------------------------------------
    > cd %userprofile%\Local Settings\Temporary Internet Files\OLK*
    > del *.* /s /f /q
    > --------------------------------------------------------------------------------
    >
    > Can a .bat file be assigned as a 'shutdown script' via group policy?
    > Appreciate any feedback or optional advice. Thank you.


    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.




  4. #4
    Callypso Guest

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

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

    for more information see:
    http://technet2.microsoft.com/window....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

    "Barkley Bees" wrote:

    > 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:
    >
    > --------------------------------------------------------------------------------
    > cd %userprofile%\Local Settings\Temporary Internet Files\OLK*
    > del *.* /s /f /q
    > --------------------------------------------------------------------------------
    >
    > Can a .bat file be assigned as a 'shutdown script' via group policy?
    > Appreciate any feedback or optional advice. Thank you.
    >
    >
    >


  5. #5
    Juan I. Cahis Guest

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

    Dear friends, but there is a problem.

    I use a similar script (I downloaded it from a posting in a
    newsgroup), but sometimes, some of the files in the OLK* have the read
    only, or the hidden, or the system attribute set. Could you modify
    your script to unset these attribute bits before?

    Callypso <Callypso@discussions.microsoft.com> wrote:

    >You can use BAT files as shutdown script, that's no problem.
    >
    >for more information see:
    >http://technet2.microsoft.com/window....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 Iuse
    >in our network
    >
    >ERASE C:\"Documents and Settings"\%USERNAME%\"Local Settings"\"Temporary
    >Internet Files"\*.* /q /f /s
    >
    >
    >Callypso
    >Network Engineer
    >
    >"Barkley Bees" wrote:
    >
    >> Trying to find the best way to have XP client PC's clear their Outlook2003
    >> 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:
    >>
    >> --------------------------------------------------------------------------------
    >> cd %userprofile%\Local Settings\Temporary Internet Files\OLK*
    >> del *.* /s /f /q
    >> --------------------------------------------------------------------------------
    >>
    >> Can a .bat file be assigned as a 'shutdown script' via group policy?
    >> Appreciate any feedback or optional advice. Thank you.
    >>
    >>
    >>

    Thanks
    Juan I. Cahis
    Santiago de Chile (South America)
    Note: Please forgive me for my bad English, I am trying to improve it!

  6. #6
    Lanwench [MVP - Exchange] Guest

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

    Barkley Bees <barkbees@nomail.com> wrote:
    > 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:
    >
    > --------------------------------------------------------------------------------
    > cd %userprofile%\Local Settings\Temporary Internet Files\OLK*
    > del *.* /s /f /q
    > --------------------------------------------------------------------------------
    >
    > Can a .bat file be assigned as a 'shutdown script' via group policy?
    > Appreciate any feedback or optional advice. Thank you.


    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/micr...ry-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.

    --------------------
    FOR /F %%A IN ('DIR/B "C:\Documents and Settings"') DO DEL/S/F/Q
    "C:\Documents and Settings\%%A\Local Settings\Temporary Internet Files\*.*"
    FOR /F %%A IN ('DIR/B "C:\Documents and Settings"') DO RD/S/Q "C:\Documents
    and Settings\%%A\Local Settings\Temporary Internet Files\"






  7. #7
    Barkley Bees Guest

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

    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]"
    <lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote in message
    news:uAcGdrbcIHA.3572@TK2MSFTNGP02.phx.gbl...
    > Barkley Bees <barkbees@nomail.com> wrote:
    >> 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:
    >>
    >> --------------------------------------------------------------------------------
    >> cd %userprofile%\Local Settings\Temporary Internet Files\OLK*
    >> del *.* /s /f /q
    >> --------------------------------------------------------------------------------
    >>
    >> Can a .bat file be assigned as a 'shutdown script' via group policy?
    >> Appreciate any feedback or optional advice. Thank you.

    >
    > 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/micr...ry-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.
    >
    > --------------------
    > FOR /F %%A IN ('DIR/B "C:\Documents and Settings"') DO DEL/S/F/Q
    > "C:\Documents and Settings\%%A\Local Settings\Temporary Internet
    > Files\*.*"
    > FOR /F %%A IN ('DIR/B "C:\Documents and Settings"') DO RD/S/Q
    > "C:\Documents and Settings\%%A\Local Settings\Temporary Internet Files\"
    >
    >
    >
    >
    >




  8. #8
    Lanwench [MVP - Exchange] Guest

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

    Barkley Bees <barkbees@nomail.com> wrote:
    > 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,


    What on earth do they think "temporary" is supposed to mean?

    > 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?


    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]"
    > <lanwench@heybuddy.donotsendme.unsolicitedmailatyahoo.com> wrote in
    > message news:uAcGdrbcIHA.3572@TK2MSFTNGP02.phx.gbl...
    >> Barkley Bees <barkbees@nomail.com> wrote:
    >>> 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:
    >>>
    >>> --------------------------------------------------------------------------------
    >>> cd %userprofile%\Local Settings\Temporary Internet Files\OLK*
    >>> del *.* /s /f /q
    >>> --------------------------------------------------------------------------------
    >>>
    >>> Can a .bat file be assigned as a 'shutdown script' via group policy?
    >>> Appreciate any feedback or optional advice. Thank you.

    >>
    >> 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/micr...ry-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. --------------------
    >> FOR /F %%A IN ('DIR/B "C:\Documents and Settings"') DO DEL/S/F/Q
    >> "C:\Documents and Settings\%%A\Local Settings\Temporary Internet
    >> Files\*.*"
    >> FOR /F %%A IN ('DIR/B "C:\Documents and Settings"') DO RD/S/Q
    >> "C:\Documents and Settings\%%A\Local Settings\Temporary Internet
    >> Files\"





  9. #9
    Join Date
    Nov 2008
    Posts
    1

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

    Was just trying to write a script to clear out OLK directory contents, this post was very helpful. I managed to expand on the script to just delete the contents of all the OLK directories for all profiles on the machine, thought others may find it useful...

    FOR /F %%A IN ('DIR/B "C:\Documents and Settings"') DO FOR /F %%B IN ('DIR/B "C:\Documents and Settings\%%A\Local Settings\Temporary Internet Files\OLK*"') DO DEL/S/F/Q "C:\Documents and Settings\%%A\Local Settings\Temporary Internet Files\%%B\*.*"

  10. #10
    Al Dunbar Guest

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


    "alex90" <alex90.3j85zc@DoNotSpam.com> wrote in message
    news:alex90.3j85zc@DoNotSpam.com...
    >
    > Was just trying to write a script to clear out OLK directory contents,
    > this post was very helpful. I managed to expand on the script to just
    > delete the contents of all the OLK directories for all profiles on the
    > machine, thought others may find it useful...
    >
    > FOR /F %%A IN ('DIR/B "C:\Documents and Settings"') DO FOR /F %%B IN
    > ('DIR/B "C:\Documents and Settings\%%A\Local Settings\Temporary Internet
    > Files\OLK*"') DO DEL/S/F/Q "C:\Documents and Settings\%%A\Local
    > Settings\Temporary Internet Files\%%B\*.*"


    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

    > --
    > alex90
    > ------------------------------------------------------------------------
    > alex90's Profile: http://forums.techarena.in/members/alex90.htm
    > View this thread: http://forums.techarena.in/server-scripting/913402.htm
    >
    > http://forums.techarena.in
    >




  11. #11
    Join Date
    Dec 2010
    Posts
    1

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

    So far as the batch file is concerned, I wrote this one which will accomplish the task and it's safe.


    Code:
    @echo off
    setlocal enabledelayedexpansion
    for /f "tokens=5 delims=\" %%f in ('reg query hkcu\software\microsoft\office^|findstr "[0-9][0-9][.][0-9]"') do (
    	call :ver %%f
    )
    goto :eof
    
    :ver
    for /f "skip=2 tokens=2 delims=:" %%f in ('reg query hkcu\software\microsoft\office\%1\outlook\security /v outlooksecuretempfolder') do (
    	set var=%systemdrive%%%f
    	if exist "!var!" (	
    		echo Found: %1
    		echo Folder: !var!
    		echo Cleaning...
    		rd "!var!" /s /q
    		echo Done!
    	) else (
    		echo Folder !var! found in registry does not exist, skipping.
    	)
    )
    Next, you need to invoke the group policy editor. To do that :

    1. Click the Start button
    2. Select "Run"
    3. type "gpedit.msc" (without the quotes) in the "open" box and click OK or press Enter
    4. Windows opens up the Group Policy editor.

    In the left part of the screen, navigate to Computer Configuration->Windows Settings and select "Scripts (Startup/shutdown)".

    In the right part of the screen, right-click "Shutdown" and select "properties"

    In the shutdown properties dialog, click the "add button"

    Enter the path and batch file name in the script name field (leave the script parameters field empty for this example)

    Click ok

    Click ok once more

    You can now close the Group Policy editor, your Windows shutdown script is ready and will be executed each time you shut down Windows.

    If you are curious where you can add logon/logoff scripts, they are in the Group Policy editor under User Configuration->Windows Settings->Scripts (Logon/logoff)

    This was posted for prosperity... ;-)


    Quote Originally Posted by Barkley Bees View Post
    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:

    --------------------------------------------------------------------------------
    cd %userprofile%\Local Settings\Temporary Internet Files\OLK*
    del *.* /s /f /q
    --------------------------------------------------------------------------------

    Can a .bat file be assigned as a 'shutdown script' via group policy?
    Appreciate any feedback or optional advice. Thank you.

Similar Threads

  1. Replies: 3
    Last Post: 22-05-2012, 05:32 PM
  2. Hidden Outlook Temp folder
    By Garlands in forum Windows Software
    Replies: 7
    Last Post: 13-09-2011, 08:52 PM
  3. How to Delete set3.temp files from windows folder
    By afidelino in forum Windows Software
    Replies: 4
    Last Post: 01-04-2010, 06:01 PM
  4. Perflib_Perfdata dat files in temp folder
    By chaosblade in forum Operating Systems
    Replies: 3
    Last Post: 13-06-2009, 08:38 AM
  5. Where is my temp files folder & cookies folder?
    By aftab1 in forum Operating Systems
    Replies: 2
    Last Post: 05-11-2008, 12:58 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,668,492.26591 seconds with 17 queries