Solved

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

Posted on 2004-09-10
4
225 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now