Sign in to follow this  
Followers 0
JackFlashJI

Issue with DriveMapAdd

5 posts in this topic

I am mapping a drive using the following command:

DriveMapAdd("P:", "\\<servername>\<sharename>", 0, "<username>", "<password>")

The command is running and connecting me to the drive because I have access to data on that drive, but I cannot see the mapped drive.

I right click on my computer and select Map Network Drive, click the drive letter and P is displayed without the mapping.

I open a prompt and enter net use, but it is not displayed

Is there something else I need to add to this very simple script to display the mapped drive?

I am running this on Windows XP.

Share this post


Link to post
Share on other sites



I am mapping a drive using the following command:

DriveMapAdd("P:", "\\<servername>\<sharename>", 0, "<username>", "<password>")

The command is running and connecting me to the drive because I have access to data on that drive, but I cannot see the mapped drive.

I right click on my computer and select Map Network Drive, click the drive letter and P is displayed without the mapping.

I open a prompt and enter net use, but it is not displayed

Is there something else I need to add to this very simple script to display the mapped drive?

I am running this on Windows XP.

If you cannot see the mapped drive, then why are you sure "The command is running and connecting me..."?

Do some basic error checking/handling:

If Not DriveMapAdd("P:", "\\<servername>\<sharename>", 0, "<username>", "<password>") Then
      MsgBox(16, "Error", "Drive mapping failed, @error = " & @error)
EndIf

The meaning of the @error codes is in the help file.

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

We run an application that uses data from this mapped drive. When the command has been run, we can pull all the data we need. If the command has not been run, then we have to manually map the drive.

So the way that I know the drive has been mapped..... The data is being pulled.

Share this post


Link to post
Share on other sites

Are you mapping just the one drive or are there more? If theres more than one try putting a small pause (like Sleep(500) ) between each mapping. We had a case were there was latency and the mapping would be there but the drive letters would not show up in Windows Explorer. We put the pause in the logon script and have not had the problem for 3 years now (knocks on wood). Microsoft had a long explaination why it happens (timing in writing to some registry keys and the speed of the script running vs the actual mapping) but meh whatever, it worked for us.

Share this post


Link to post
Share on other sites

We are only mapping a single drive.

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
Sign in to follow this  
Followers 0