Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VBScript fso.deletefolder permission denied error on Vista

Posted on 2010-08-17
4
Medium Priority
?
2,524 Views
Last Modified: 2012-05-10
Hi,

I want to add a function to delete the Outlook cache folder from my VBscript login script.

The additional code runs Ok but the folder is not deleted.

I took it out of the main body of the login script and tested separately and I get a permission denied error.

I have tested the script on another test folder on my desktop where I know I have permissions and it deletes the folder and displays the message.

Our PCs are Vista by the way...

Here is my script

dim WSHShell, fullpath, objFSO
set objFSO=CreateObject("Scripting.FileSystemObject")
Set WSHshell = CreateObject("WScript.Shell")
path="%userprofile%"
fullpath= WSHshell.ExpandEnvironmentStrings(path)
sCurrUsrPath = (fullpath & "\Appdata\Local\Microsoft\Windows\Temporary Internet Files\")

'Verify whether the Cache exists and delete it
If objFSO.FolderExists(sCurrUsrPath) Then
Const DeleteReadOnly = True
objFSO.DeleteFolder(sCurrUsrPath), DeleteReadOnly

msgbox "The Cache has been cleared successfully"

Else

msgbox "Cannot find the Cache. It may have been cleared already."

End If

Thanks in advance for any help!
Regards
0
Comment
Question by:Daza_WIlliams
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 5

Expert Comment

by:xdomains
ID: 33453129
Launch your app with "Run as administrator". Or, disable UAC.
0
 

Accepted Solution

by:
Daza_WIlliams earned 0 total points
ID: 33453144
Hi,

Sorry, I have fixed the issue, strangely when I took out the / at the end of the path it worked.

eg: Orginal path
sCurrUsrPath = (fullpath & "\Appdata\Local\Microsoft\Windows\Temporary Internet Files\")

Updated path
sCurrUsrPath = (fullpath & "\Appdata\Local\Microsoft\Windows\Temporary Internet Files")

Thanks anyway!
0
 
LVL 5

Expert Comment

by:xdomains
ID: 33453150
It is possible that some files are in use. If you do have admin rights, then I guess some files are in use? UAC may not be the issue.
0
 
LVL 5

Expert Comment

by:xdomains
ID: 33453153
Ok, Good..:)
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Introduction to Processes

715 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