Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Outlook secure temp folder

Reply
 
Old 11-14-2008   #1 (permalink)
David


 
 

Outlook secure temp folder

There is a randomly generated folder for Outlook to store temporary files
opened within. I have figured out how to delete these extra files on OL2003
using a dos batch file.

@echo off
if exist "%userprofile%\Local Settings\Temporary Internet Files\OLK*" (cd
"%userprofile%\Local Settings\Temporary Internet Files\OLK*") else (goto
END)
del *.* /s /f /q
del *.* /ah /f /q
del *.* /ar /f /q
del *.* /aa /f /q
del *.* /as /f /q
goto END
:END
exit

Problem is, we're moving to OL2007 and the name of the folder is even more
random. On my machine now its "LPR4OFZ4" and on other machines here in our
corporate network they are different names. I can't figure out how to change
to a random directory in dos, so i'd like to goto VB. I have done some VB
here, but nothing to get a random name of this folder.
The registry location is :
HKCU\software\Microsoft\Office\12.0\outlook\security and the name of the key
is "outlooksecuretempfolder". I'd like to pick the random name off the end
after the last \ in the registry and use it in the vb for deletions.


Is there a way in VB to find the name of this folder or read it from the
registry and incorporate the file deletions into the script for both OL2003
and OL2007?



My System SpecsSystem Spec
Old 11-14-2008   #2 (permalink)
Luuk


 
 

Re: Outlook secure temp folder

David schreef:
Quote:

> There is a randomly generated folder for Outlook to store temporary
> files opened within. I have figured out how to delete these extra files
> on OL2003 using a dos batch file.
>
> @echo off
> if exist "%userprofile%\Local Settings\Temporary Internet Files\OLK*"
> (cd "%userprofile%\Local Settings\Temporary Internet Files\OLK*") else
> (goto END)
> del *.* /s /f /q
> del *.* /ah /f /q
> del *.* /ar /f /q
> del *.* /aa /f /q
> del *.* /as /f /q
> goto END
> :END
> exit
>
> Problem is, we're moving to OL2007 and the name of the folder is even
> more random. On my machine now its "LPR4OFZ4" and on other machines here
> in our corporate network they are different names. I can't figure out
> how to change to a random directory in dos, so i'd like to goto VB. I
> have done some VB here, but nothing to get a random name of this folder.
> The registry location is :
> HKCU\software\Microsoft\Office\12.0\outlook\security and the name of the
> key is "outlooksecuretempfolder". I'd like to pick the random name off
> the end after the last \ in the registry and use it in the vb for
> deletions.
>
>
> Is there a way in VB to find the name of this folder or read it from the
> registry and incorporate the file deletions into the script for both
> OL2003 and OL2007?
>
>
> ------------------------------------------------------------------------
>
this tool can do it:
http://www.autoitscript.com/autoit3/index.shtml

i mean, read registry, and delete files.

you yourself should write the script in the syntax of this tool... ;-)
My System SpecsSystem Spec
Old 11-14-2008   #3 (permalink)
Luuk


 
 

Re: Outlook secure temp folder

Luuk schreef:
Quote:

> David schreef:
Quote:

>> There is a randomly generated folder for Outlook to store temporary
>> files opened within. I have figured out how to delete these extra
>> files on OL2003 using a dos batch file.
>>
>> @echo off
>> if exist "%userprofile%\Local Settings\Temporary Internet Files\OLK*"
>> (cd "%userprofile%\Local Settings\Temporary Internet Files\OLK*") else
>> (goto END)
>> del *.* /s /f /q
>> del *.* /ah /f /q
>> del *.* /ar /f /q
>> del *.* /aa /f /q
>> del *.* /as /f /q
>> goto END
>> :END
>> exit
>>
>> Problem is, we're moving to OL2007 and the name of the folder is even
>> more random. On my machine now its "LPR4OFZ4" and on other machines
>> here in our corporate network they are different names. I can't figure
>> out how to change to a random directory in dos, so i'd like to goto
>> VB. I have done some VB here, but nothing to get a random name of this
>> folder.
>> The registry location is :
>> HKCU\software\Microsoft\Office\12.0\outlook\security and the name of
>> the key is "outlooksecuretempfolder". I'd like to pick the random name
>> off the end after the last \ in the registry and use it in the vb for
>> deletions.
>>
>>
>> Is there a way in VB to find the name of this folder or read it from
>> the registry and incorporate the file deletions into the script for
>> both OL2003 and OL2007?
>>
>>
>> ------------------------------------------------------------------------
>>
>
> this tool can do it:
> http://www.autoitscript.com/autoit3/index.shtml
>
> i mean, read registry, and delete files.
>
> you yourself should write the script in the syntax of this tool... ;-)
ok, i could not resist (but not test):

$var = RegRead("HKCU\software\Microsoft\Office\12.0\outlook\security",
"outlooksecuretempfolder")
MsgBox(4096, "outlooksecuretempfolder in:", $var)
if $var<>"" then
FileDelete($var)
endif


My System SpecsSystem Spec
Old 11-14-2008   #4 (permalink)
David


 
 

Re: Outlook secure temp folder

I found a way to do it and this is working:
pulled from this group, 11/4/2008 9:49 am from John.Renfrow's post.

Deletes read-only, archive, system and hidden, hence the four lines::
only one issue: if the OutlookSecureTempFolder is not there, it throws an
error and stops.

'Delete OL2007 OutlookSecureTempFolder files
'
Set oWSH = CreateObject("WScript.Shell")
sOutSecTmp = oWSH.RegRead("HKCU\Software\Microsoft\Office\12.0" _
& "\Outlook\Security\OutlookSecureTempFolder")
If Len(sOutSecTmp) = 0 Then WScript.Quit 'Make sure var isn't empty
oWSH.Run "%comspec% /c del """ & sOutSecTmp & "\*.*"" /ar /q", 0, False
oWSH.Run "%comspec% /c del """ & sOutSecTmp & "\*.*"" /aa /q", 0, False
oWSH.Run "%comspec% /c del """ & sOutSecTmp & "\*.*"" /as /q", 0, False
oWSH.Run "%comspec% /c del """ & sOutSecTmp & "\*.*"" /ah /q", 0, False

'Delete OL2003 OutlookSecureTempFolder files

Set oWSH1 = CreateObject("WScript.Shell")
sOutSecTmp1 = oWSH1.RegRead("HKCU\Software\Microsoft\Office\11.0" _
& "\Outlook\Security\OutlookSecureTempFolder")
If Len(sOutSecTmp1) = 0 Then WScript.Quit 'Make sure var isn't empty
oWSH1.Run "%comspec% /c del """ & sOutSecTmp1 & "\*.*"" /ar /q", 0, False
oWSH1.Run "%comspec% /c del """ & sOutSecTmp1 & "\*.*"" /aa /q", 0, False
oWSH1.Run "%comspec% /c del """ & sOutSecTmp1 & "\*.*"" /as /q", 0, False
oWSH1.Run "%comspec% /c del """ & sOutSecTmp1 & "\*.*"" /ah /q", 0, False


"David" <David@xxxxxx> wrote in message
news:e3FODsnRJHA.4772@xxxxxx
Quote:

> There is a randomly generated folder for Outlook to store temporary files
> opened within. I have figured out how to delete these extra files on
> OL2003
> using a dos batch file.
>
> @echo off
> if exist "%userprofile%\Local Settings\Temporary Internet Files\OLK*" (cd
> "%userprofile%\Local Settings\Temporary Internet Files\OLK*") else (goto
> END)
> del *.* /s /f /q
> del *.* /ah /f /q
> del *.* /ar /f /q
> del *.* /aa /f /q
> del *.* /as /f /q
> goto END
> :END
> exit
>
> Problem is, we're moving to OL2007 and the name of the folder is even more
> random. On my machine now its "LPR4OFZ4" and on other machines here in our
> corporate network they are different names. I can't figure out how to
> change
> to a random directory in dos, so i'd like to goto VB. I have done some VB
> here, but nothing to get a random name of this folder.
> The registry location is :
> HKCU\software\Microsoft\Office\12.0\outlook\security and the name of the
> key
> is "outlooksecuretempfolder". I'd like to pick the random name off the end
> after the last \ in the registry and use it in the vb for deletions.
>
>
> Is there a way in VB to find the name of this folder or read it from the
> registry and incorporate the file deletions into the script for both
> OL2003
> and OL2007?
>
>
My System SpecsSystem Spec
Old 11-16-2008   #5 (permalink)
James Whitlow


 
 

Re: Outlook secure temp folder

"David" <David@xxxxxx> wrote in message
news:eSLhOyoRJHA.144@xxxxxx
Quote:

>I found a way to do it and this is working:
> pulled from this group, 11/4/2008 9:49 am from John.Renfrow's post.
>
> Deletes read-only, archive, system and hidden, hence the four lines::
> only one issue: if the OutlookSecureTempFolder is not there, it throws an
> error and stops.
One method would be to use 'On Error Resume Next'. Just make sure you
check that your variable is not empty before executing your delete command
or you could accidentally delete all of the files from the hard drive. Also,
you can put your two different versions into a loop to prevent duplication
and use the 'Scripting.FileSystemObject' to delete the files using a single
line. Try the code below:

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set oWSH = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")

For Each sKey in Array("11.0","12.0")
sOutSecTmp = Empty
On Error Resume Next
sOutSecTmp = oWSH.RegRead("HKCU\Software\Microsoft\Office\" _
& sKey & "\Outlook\Security\OutlookSecureTempFolder")
If Len(sOutSecTmp) > 3 Then
oFSO.DeleteFile oFSO.BuildPath(sOutSecTmp,"*.*"), True
End If
Next
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You could also use the WMI registry provider. It has the ability to
enumerate a key, unlike the built-in provider. It should work with multiple
versions of Outlook as long as the 'OutlookSecureTempFolder' is in the same
location.

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oReg = GetObject("winmgmts:root/default:StdRegProv")

Const HKCU = &H80000001

oReg.EnumKey HKCU, "Software\Microsoft\Office", aKeys

For Each sKey in aKeys
oReg.GetStringValue HKCU, "Software\Microsoft\Office\" & sKey & _
"\Outlook\Security", "OutlookSecureTempFolder", sOutSecTmp
If Not IsNull(sOutSecTmp) Then
If Len(sOutSecTmp) > 3 Then
oFSO.DeleteFile oFSO.BuildPath(sOutSecTmp,"*.*"), True
End If
End If
Next
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


My System SpecsSystem Spec
Old 12-10-2008   #6 (permalink)
PaulyBalls


 
 

Re: Outlook secure temp folder

On Nov 16, 2:40*am, "James Whitlow" <jwhitlow.60372...@xxxxxx>
wrote:
Quote:

> "David" <Da...@xxxxxx> wrote in message
>
> news:eSLhOyoRJHA.144@xxxxxx
>
Quote:

> >I found a way to do it and this is working:
> > pulled from this group, 11/4/2008 9:49 am from John.Renfrow's post.
>
Quote:

> > Deletes read-only, archive, system and hidden, hence the four lines::
> > only one issue: if the OutlookSecureTempFolder is not there, it throws an
> > error and stops.
>
> * One method would be to use 'On Error Resume Next'. Just make sure you
> check that your variable is not empty before executing your delete command
> or you could accidentally delete all of the files from the hard drive. Also,
> you can put your two different versions into a loop to prevent duplication
> and use the 'Scripting.FileSystemObject' to delete the files using a single
> line. Try the code below:
>
> '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Set oWSH = CreateObject("WScript.Shell")
> Set oFSO = CreateObject("Scripting.FileSystemObject")
>
> For Each sKey in Array("11.0","12.0")
> *sOutSecTmp = Empty
> *On Error Resume Next
> *sOutSecTmp = oWSH.RegRead("HKCU\Software\Microsoft\Office\" _
> * & sKey & "\Outlook\Security\OutlookSecureTempFolder")
> *If Len(sOutSecTmp) > 3 Then
> * oFSO.DeleteFile oFSO.BuildPath(sOutSecTmp,"*.*"), True
> *End If
> Next
> '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> * You could also use the WMI registry provider. It has the ability to
> enumerate a key, unlike the built-in provider. It should work with multiple
> versions of Outlook as long as the 'OutlookSecureTempFolder' is in the same
> location.
>
> '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Set oFSO = CreateObject("Scripting.FileSystemObject")
> Set oReg = GetObject("winmgmts:root/default:StdRegProv")
>
> Const HKCU = &H80000001
>
> oReg.EnumKey HKCU, "Software\Microsoft\Office", aKeys
>
> For Each sKey in aKeys
> *oReg.GetStringValue HKCU, "Software\Microsoft\Office\" & sKey & _
> * "\Outlook\Security", "OutlookSecureTempFolder", sOutSecTmp
> *If Not IsNull(sOutSecTmp) Then
> * If Len(sOutSecTmp) > 3 Then
> * *oFSO.DeleteFile oFSO.BuildPath(sOutSecTmp,"*.*"), True
> * End If
> *End If
> Next
> '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
How do I make this run when Outlook is closed. I have no idea how to
use scripting. Can someone walk me through it?
My System SpecsSystem Spec
Old 12-10-2008   #7 (permalink)
James Whitlow


 
 

Re: Outlook secure temp folder

"PaulyBalls" <paul.panus@xxxxxx> wrote in message
news:6450abc1-fa9f-49cb-b088-a599dc4a9d91@xxxxxx

On Nov 16, 2:40 am, "James Whitlow" <jwhitlow.60372...@xxxxxx>
wrote:
Quote:
Quote:

>> "David" <Da...@xxxxxx> wrote in message
>>
>> news:eSLhOyoRJHA.144@xxxxxx
>>
Quote:

>> >I found a way to do it and this is working:
>> > pulled from this group, 11/4/2008 9:49 am from John.Renfrow's post.
>>
Quote:

>> > Deletes read-only, archive, system and hidden, hence the four lines::
>> > only one issue: if the OutlookSecureTempFolder is not there, it throws
>> > an
>> > error and stops.
>>
>> One method would be to use 'On Error Resume Next'. Just make sure you
>> check that your variable is not empty before executing your delete
>> command
>> or you could accidentally delete all of the files from the hard drive.
>> Also,
>> you can put your two different versions into a loop to prevent
>> duplication
>> and use the 'Scripting.FileSystemObject' to delete the files using a
>> single
>> line. Try the code below:
>>
>> '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> Set oWSH = CreateObject("WScript.Shell")
>> Set oFSO = CreateObject("Scripting.FileSystemObject")
>>
>> For Each sKey in Array("11.0","12.0")
>> sOutSecTmp = Empty
>> On Error Resume Next
>> sOutSecTmp = oWSH.RegRead("HKCU\Software\Microsoft\Office\" _
>> & sKey & "\Outlook\Security\OutlookSecureTempFolder")
>> If Len(sOutSecTmp) > 3 Then
>> oFSO.DeleteFile oFSO.BuildPath(sOutSecTmp,"*.*"), True
>> End If
>> Next
>> '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> You could also use the WMI registry provider. It has the ability to
>> enumerate a key, unlike the built-in provider. It should work with
>> multiple
>> versions of Outlook as long as the 'OutlookSecureTempFolder' is in the
>> same
>> location.
>>
>> '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> Set oFSO = CreateObject("Scripting.FileSystemObject")
>> Set oReg = GetObject("winmgmts:root/default:StdRegProv")
>>
>> Const HKCU = &H80000001
>>
>> oReg.EnumKey HKCU, "Software\Microsoft\Office", aKeys
>>
>> For Each sKey in aKeys
>> oReg.GetStringValue HKCU, "Software\Microsoft\Office\" & sKey & _
>> "\Outlook\Security", "OutlookSecureTempFolder", sOutSecTmp
>> If Not IsNull(sOutSecTmp) Then
>> If Len(sOutSecTmp) > 3 Then
>> oFSO.DeleteFile oFSO.BuildPath(sOutSecTmp,"*.*"), True
>> End If
>> End If
>> Next
>> '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quote:

> How do I make this run when Outlook is closed. I have no idea how to
> use scripting. Can someone walk me through it?
Just copy the code in my original reply and save it to a file with a '.vbs'
extension. The code does not need Outlook to be running to work. It is
simply reading the registry.


My System SpecsSystem Spec
Old 12-11-2008   #8 (permalink)
PaulyBalls


 
 

Re: Outlook secure temp folder

On Dec 10, 4:49*pm, "James Whitlow" <jwhitlow.60372...@xxxxxx>
wrote:
Quote:

> "PaulyBalls" <paul.pa...@xxxxxx> wrote in message
>
> news:6450abc1-fa9f-49cb-b088-a599dc4a9d91@xxxxxx
>
> On Nov 16, 2:40 am, "James Whitlow" <jwhitlow.60372...@xxxxxx>
> wrote:
>
>
>
Quote:
Quote:

> >> "David" <Da...@xxxxxx> wrote in message
>
Quote:
Quote:

> >>news:eSLhOyoRJHA.144@xxxxxx
>
Quote:
Quote:

> >> >I found a way to do it and this is working:
> >> > pulled from this group, 11/4/2008 9:49 am from John.Renfrow's post.
>
Quote:
Quote:

> >> > Deletes read-only, archive, system and hidden, hence the four lines::
> >> > only one issue: if the OutlookSecureTempFolder is not there, it throws
> >> > an
> >> > error and stops.
>
Quote:
Quote:

> >> One method would be to use 'On Error Resume Next'. Just make sure you
> >> check that your variable is not empty before executing your delete
> >> command
> >> or you could accidentally delete all of the files from the hard drive.
> >> Also,
> >> you can put your two different versions into a loop to prevent
> >> duplication
> >> and use the 'Scripting.FileSystemObject' to delete the files using a
> >> single
> >> line. Try the code below:
>
Quote:
Quote:

> >> '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> Set oWSH = CreateObject("WScript.Shell")
> >> Set oFSO = CreateObject("Scripting.FileSystemObject")
>
Quote:
Quote:

> >> For Each sKey in Array("11.0","12.0")
> >> sOutSecTmp = Empty
> >> On Error Resume Next
> >> sOutSecTmp = oWSH.RegRead("HKCU\Software\Microsoft\Office\" _
> >> & sKey & "\Outlook\Security\OutlookSecureTempFolder")
> >> If Len(sOutSecTmp) > 3 Then
> >> oFSO.DeleteFile oFSO.BuildPath(sOutSecTmp,"*.*"), True
> >> End If
> >> Next
> >> '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
Quote:
Quote:

> >> You could also use the WMI registry provider. It has the ability to
> >> enumerate a key, unlike the built-in provider. It should work with
> >> multiple
> >> versions of Outlook as long as the 'OutlookSecureTempFolder' is in the
> >> same
> >> location.
>
Quote:
Quote:

> >> '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> Set oFSO = CreateObject("Scripting.FileSystemObject")
> >> Set oReg = GetObject("winmgmts:root/default:StdRegProv")
>
Quote:
Quote:

> >> Const HKCU = &H80000001
>
Quote:
Quote:

> >> oReg.EnumKey HKCU, "Software\Microsoft\Office", aKeys
>
Quote:
Quote:

> >> For Each sKey in aKeys
> >> oReg.GetStringValue HKCU, "Software\Microsoft\Office\" & sKey & _
> >> "\Outlook\Security", "OutlookSecureTempFolder", sOutSecTmp
> >> If Not IsNull(sOutSecTmp) Then
> >> If Len(sOutSecTmp) > 3 Then
> >> oFSO.DeleteFile oFSO.BuildPath(sOutSecTmp,"*.*"), True
> >> End If
> >> End If
> >> Next
> >> '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > How do I make this run when Outlook is closed. *I have no idea how to
> > use scripting. *Can someone walk me through it?
>
> Just copy the code in my original reply and save it to a file with a '.vbs'
> extension. The code does not need Outlook to be running to work. It is
> simply reading the registry.
Thanks for the reply. No just ONE more question. Is there any way to
make this script run every time Outlook is closed?
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Windows Vista strange settings on temp folder AppData\Local\Temp\1 Vista security
Create vbscript to empty secure temp folder when exiting Outlook. VB Script
Error trying to secure a folder General Discussion
Where is my temp files folder, and my cookies folder?? Vista file management
A Secure Password Folder Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46