|
-
Oct 23rd, 2012, 07:20 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] VBScript errors with 'Access is Denied'

We have a .net application in our project that is giving me problems on my machine. Part of the app calls various .vbs files to perform batch operations - zipping files and moving them around mostly. The code works on the original developer's machine, but it errors on mine - throwing up a message box. The msgbox title says "Compressed (zipped) Folders Error", while the msgbox itself says 'Unable to complete the operation' and 'Access is Denied'.
Has anyone seen anything like this before? I'm wondering if the message I'm getting is a red-herring.
Here's one of the scripts:
Code:
Dim fso, winShell, MyTarget, MySource, file
Set fso = CreateObject("Scripting.FileSystemObject")
Set winShell = createObject("shell.application")
'find the current dir
dim CurDir, oShell
Set oShell = CreateObject("WScript.Shell")
CurDir = oShell.CurrentDirectory
'get source and target paths
MyTarget = fso.GetParentFolderName(curdir) & "\zip\copy.qd_calculator.zip"
MySource = fso.GetParentFolderName(CurDir) & "\standalone\calculator\"
'delete the old file, if it exists
if fso.FileExists(MyTarget) then
fso.DeleteFile mytarget, true
end if
'create a new clean zip archive
Set file = fso.CreateTextFile(MyTarget, True)
file.write("PK" & chr(5) & chr(6) & string(18,chr(0)))
file.close
winShell.NameSpace(MyTarget).CopyHere winShell.NameSpace(MySource).Items
do until winShell.namespace(MyTarget).items.count = winShell.namespace(MySource).items.count
wscript.sleep 1000
loop
Set winShell = Nothing
Set fso = Nothing
MsgBox("Calculator copy zipped to:" & vbcrlf & MyTarget)
 I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Oct 24th, 2012, 07:31 AM
#2
New Member
Re: VBScript errors with 'Access is Denied'
Hi have you looked into things outside of the vb realm?
For instance permissions issues? Writer may be on xp and you on Win7. Writer may be admin on local machine and you user. What are your rights do directories on the machine? These types of things seem likely to be the issue as much as anything.
-
Oct 24th, 2012, 08:42 AM
#3
Thread Starter
Frenzied Member
Re: VBScript errors with 'Access is Denied'
See, that's what I don't understand. I'm an admin on my machine and have full control over the directories in question - except the zip file that get's created. I can neither open it nor delete it - it says I need administrative permission to do so.
I never have understood windows security.
 I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Oct 24th, 2012, 08:48 AM
#4
Re: VBScript errors with 'Access is Denied'
Can you open the zip manually? outside of the app?
-tg
-
Oct 24th, 2012, 09:07 AM
#5
Thread Starter
Frenzied Member
Re: VBScript errors with 'Access is Denied'
Nope. It says I need to be an administrator to do that - which I am.
 I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Oct 24th, 2012, 09:10 AM
#6
Re: VBScript errors with 'Access is Denied'
sounds like a file ownership issue... but I wouldn't know how to change that or what would need to be changed in the code.
-tg
-
Oct 24th, 2012, 09:29 AM
#7
Thread Starter
Frenzied Member
Re: VBScript errors with 'Access is Denied'
After putting in some msgboxes, it seems the offending line is:
winShell.NameSpace(MyTarget).CopyHere winShell.NameSpace(MySource).Items
It seems to start copying some of the files from the source directory to the target zipfile, but then fails at some point.
 I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Oct 24th, 2012, 10:20 AM
#8
Thread Starter
Frenzied Member
Re: VBScript errors with 'Access is Denied'
It's interesting. The script seems to have the permission to delete the existing zip file - even if the zip file has no permissions set for it - but fails somehow in the adding of files to the zip file after recreating it. The script will add some files to the zip file, but not all of an individual file will get copied to the zip file before the script throws the error about access denied and gives up.
 I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Oct 24th, 2012, 10:57 AM
#9
Re: VBScript errors with 'Access is Denied'
could it be permissions on the file you're trying to add?
-tg
-
Oct 24th, 2012, 11:16 AM
#10
Thread Starter
Frenzied Member
Re: VBScript errors with 'Access is Denied'
I don't think so. I created a test directory with a text file in it that just had 'hello world' in the text file, and pointed my script to that directory instead. It gave me the same error - although it did succeed in getting the file copied to the zip file. I looked at the 'test' text file I created and nothing appeared amiss.
 I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Oct 24th, 2012, 01:13 PM
#11
New Member
Re: VBScript errors with 'Access is Denied'
Is it copying or moving? If moving it may be erroring due to not having permissions to delete the original file.
Get your permissions sorted out, you should be able to read/write/delete anything in the folders involved.
Last edited by IGeeky1; Oct 24th, 2012 at 01:14 PM.
Reason: Adding line
-
Oct 24th, 2012, 01:18 PM
#12
Thread Starter
Frenzied Member
Re: VBScript errors with 'Access is Denied'
It's a copy process.
More info...
When the script initially creates the zip file, it has all the permissions that a normal file would have if you just right-clicked on windows explorer and created a new file. However, after the file transfer step has bombed, the zip file has lost all it's permissions - no users or groups have permission to access it.
 I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Oct 24th, 2012, 01:55 PM
#13
Re: VBScript errors with 'Access is Denied'
just for gits and shiggles... what happens if you do it manually yourself? create the file by right clicking... then adding files... is it a particular file? it just sounds like a really weird thing going on.
-tg
-
Oct 24th, 2012, 02:02 PM
#14
Thread Starter
Frenzied Member
Re: VBScript errors with 'Access is Denied'
Yep, it happens when I try to do it manually also.
So let me try one file at a time and see what that does.
 I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Oct 24th, 2012, 02:12 PM
#15
Thread Starter
Frenzied Member
Re: VBScript errors with 'Access is Denied'
So, it doesn't seem to matter what file I choose to add to the zip file, or where I get the file from that I add to the zip file, or what directory the zip file is created in. Anywhere I create a zip file on my system and try to add files to it, I get the 'Access is Denied' error and the zip file looses its permissions. But once I go to the Properties | Security tab for the zip file and add 'Administrators' to the groups and give them full control over the zip file, then I can add files without any problem.
so it sounds like some kind of system setting on my machine - maybe???
 I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
-
Nov 2nd, 2012, 08:53 AM
#16
Thread Starter
Frenzied Member
Re: VBScript errors with 'Access is Denied'
Well, I ended up having to do a format and re-install and that fixed it.
Thanks everyone for the tips to try to help.
 I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
My war with a browser-redirect trojan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|