Solved

closing a 'pipeline' (open connection to a server share) from VBSCRIPT

Posted on 2004-09-10
4
227 Views
Last Modified: 2010-05-02
Hi all,

I have a problem with a script.
When I copy data from a server share and then delete the share I receive the error:

Err ID: 46 "Permission Denied"

This happens when copying and deleting is done in the same run of the script.

But when I run the script copy, don't delete it works fine
and
when I run the script don't copy/delete it works fine also.

But I want both functions into one run of the script. It looks to me there is still a connection (from the copying) which is not closed, that maybe the reason I receive the error.

I do have enough permissions to copy/delete etc from the server share.

A summary of the code:
==========

<object id="objFSO"             progid="Scripting.FileSystemObject"/>


Set TestFolder = objFSO.GetFolder("\\" & strServernaam & "\" & testfolder) 'This is correct!
IF Err.Number <> 0 THEN
   tsLogFile.WriteLine "    [DeleteShare] ERROR: Error ID: " & Hex(Err.Number) & " " & Err.Description            
   err.clear
ELSE
   err.clear
   TestFolder.Delete
    IF Err.Number <> 0 THEN
      tsLogFile.WriteLine "    [DeleteShare] ERROR: share could not be deleted. Error ID:" & Hex(Err.Number) & " " & Err.Description
    ELSE
      tsLogFile.WriteLine "    [DeleteShare] Success: share succesfully deleted"
   END IF
END IF

==========

The error occurs after the testfolder.delete command. When I put a SLEEP 60000 command before deleting (maybe it needs some time for closing the connection) it does not matter.

Any help? I'm thinking of an open connection... but how to close... Thanks!

Best Regards,

P. Keizer
(the Netherlands)

0
Comment
Question by:keizerpiet
4 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12029364
Set TestFolder = nothing

and then reopen by using

Set TestFolder = objFSO.GetFolder("\\" & strServernaam & "\" & testfolder) 'This is correct!


?
0
 
LVL 19

Accepted Solution

by:
RanjeetRain earned 500 total points
ID: 12029756
That approach is not likely to work.

MAP the share as a Network work drive and UNMAP after you are done.
0
 

Author Comment

by:keizerpiet
ID: 12042207
the Set Nothing does not work all the time.... I keep something the Permission Denied error.

Mapping could work, but we are not allowed to map drive unfortunately.

Is there a way by viewing active 'pipes' or access made to a drive/folder?

Thanks for the replies so far!
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

786 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