hendrikhe

DriveMapDel not working

4 posts in this topic

#1 ·  Posted

Hello AutoIt community,

I am adding a network folder with:

DriveMapAdd("", "\\Server01\SharedFolder","", "corp\test", "Test123")

After sending a file to this network folder with FileMove I would like to remove the access to this network folder (password protected):

$a = DriveMapDel("\\Server01\SharedFolder")

But after  DriveMapDel if I navigate manually to \\Server01\SharedFolder , I am still able to access this folder, only a loggoff helps to quit access to this shared folder.

I would like to deny the access to this folder after DriveMapDel, what I am doing wrong?

 

#include <MsgBoxConstants.au3>
#include <File.au3>
DriveMapAdd("", "\\Server01\SharedFolder","", "corp\test", "Test123")
FileMove(@MyDocumentsDir & '\test\' & "test.txt","\\Server01\SharedFolder" & @UserName& "." & @ComputerName&".txt",$FC_OVERWRITE)
$a = DriveMapDel("\\Server01\SharedFolder")


MsgBox($MB_SYSTEMMODAL, "", "DriveDel: " & $a) ; its showing 1 "success"

 

Best regards

Hendrik

 

Share this post


Link to post
Share on other sites



#3 ·  Posted

I never saw something like this , I even added:

_WinNet_CancelConnection("\\Server01\SharedFolder", True)
_WinNet_CancelConnection2("\\Server01\SharedFolder", True, True)
$a = DriveMapDel("\\Server01\SharedFolder")

Still not working, the connection is too "strong", only logging off helps:

 

DriveMapAdd("", "\\Server01\SharedFolder","", "corp\test", "Test123")
FileMove(@MyDocumentsDir & '\test\' & "test.txt","\\Server01\SharedFolder" & @UserName& "." & @ComputerName&".txt",$FC_OVERWRITE)
$a = DriveMapDel("\\Server01\SharedFolder")

_WinNet_CancelConnection("\\Server01\SharedFolder", True)

_WinNet_CancelConnection2("\\Server01\SharedFolder", True, True)

$a = DriveMapDel("\\Server01\SharedFolder")


MsgBox($MB_SYSTEMMODAL, "", "DriveDel: " & $a) ; its showing 1 "success"

 

Share this post


Link to post
Share on other sites

#4 ·  Posted

Sometimes with Windows 7, I have a similar problem, when I delete a network connection (using net use \\server\share /delete with success), but it's still accessible...

In this case, wait about 30 secconds after removing the network connection

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now