Created
November 4, 2014 15:53
-
-
Save jonman364/f2fc10ecfcf0b4692dc1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Dim objFSO, objReg | |
Dim aKeys, sKey, sectemp | |
Dim process | |
Const strProc = "OUTLOOK.EXE" | |
For Each process in GetObject("winmgmts://.").InstancesOf("win32_process") | |
If UCase(process.name) = strProc Then | |
MsgBox "Outlook is running. Please close Outlook before running this script" | |
WScript.Quit | |
End If | |
Next | |
'Set objShell = CreateObject("WScript.shell") | |
Set objReg = GetObject("winmgmts:root/default:StdRegProv") | |
Set objFSO = CreateObject("Scripting.FileSystemObject") | |
Const HKCU = &H80000001 | |
objReg.EnumKey HKCU, "Software\Microsoft\Office", aKeys | |
For Each sKey IN aKeys | |
objReg.GetStringValue HKCU, "Software\Microsoft\Office\" & sKey & "\Outlook\Security", _ | |
"OutlookSecureTempFolder", sectemp | |
If Not IsNull(sectemp) Then | |
If Len(sectemp) > 3 Then | |
sectemp = Left(sectemp, Len(sectemp) - 1) | |
If objFSO.FolderExists(sectemp) Then | |
objFSO.DeleteFolder sectemp | |
End If | |
End IF | |
End If | |
Next |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment