Solved

scheduled task to delete Outlook Secure Temp files

Posted on 2013-06-21
9
516 Views
Last Modified: 2013-07-22
I have a script to delete outlook secure temp folder and create a scheduled tasked on domain user's machines.  The problem is I have to run this scheduled task as current log on user in order to delete logon user's  in Outlook Secure Temp files.

I created a doman admin user scheduler and run this scheduled task as Scheduler, the script runs but the Outlook Secure Temp files are not deleted.

I would like to delelte outlook secure temp folders using account Scheduler's credential.

How can I achieve it?

thanks,
0
Comment
Question by:HemlockPrinters
  • 5
  • 4
9 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 39270789
Hi, HemlockPrinters.

Can you share the script so we can see for ourselves what it's doing?
0
 

Author Comment

by:HemlockPrinters
ID: 39272419
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
0
 
LVL 76

Expert Comment

by:David Lee
ID: 39272726
The script works fine for me.  I'm a little confused which account you're running it under.  Are you running it as the current user (i.e. the person who's logged in to the computer) or under some other account?
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:HemlockPrinters
ID: 39275764
no, I run it under local admin (or domain admin), the script runs without error, but it doesn't delete files.
it only works (delete files) under current log in user
0
 
LVL 76

Expert Comment

by:David Lee
ID: 39276031
That makes sense.  It's getting the path from HKCU, the current user.  If the script is running under the local admin account, then it's never going to get the path you want it to.  It's going to get the path for the local admin account.  Why not run it under the local user account?
0
 

Author Comment

by:HemlockPrinters
ID: 39278862
the password for local user's account has to be changed in 6 months, so if I run the scheduled taske uner the local user account, once the user change the password, the task will fail
0
 
LVL 76

Expert Comment

by:David Lee
ID: 39279195
It shouldn't unless you store the password with the task which I don't believe is necessary.
0
 

Accepted Solution

by:
HemlockPrinters earned 0 total points
ID: 39334813
I used group policy to set up scheduled task
0
 

Author Closing Comment

by:HemlockPrinters
ID: 39345498
there are not other resolutions
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

821 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