Jump to content
Sign in to follow this  

DriveMapAdd fails... sometimes

Recommended Posts


The following fails:

$Usr = InputBox("Security Check", "Enter your User ID without the Domain\")  
$Passwd = InputBox("Security Check", "Enter your password (it will be masked).", "", "*") 

$val = DriveMapAdd("P:", "\\servername\sharename", 0, "domain\"&$Usr, $Passwd)
The DriveMapAdd function errors out with return code 1, the @extended code is 1208 "An extended error code has occurred" which isn't much help.

The interesting thing is that this works on all remote network sites except one.

Obviously there are some differences between network configurations that I'm now digging into, but wanted to find out if anyone has experienced this.

By the way, using the DriveMapAdd function without the user account information works.

$val = DriveMapAdd("P:", "\\servername\sharename", 8)

Any help greatly appreciated.

Share this post

Link to post
Share on other sites

The only time I have had DriveMapAdd fail is when there is a slow link between sites, though I could not say what the timeout is. A couple of suggestions:

  • As you noted, DriveMapAdd will default to using the logged in user's credentials if you do not supply them. If you are only going to be mapping drives as the user logging in, omitting the two InputBoxes will make things run more smoothly.
  • I notice you're missing spaces between "domain\"&$Usr. You might try adding the spaces to see if this resolves it for you.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Share this post

Link to post
Share on other sites


Here is some additional detail that I just found out. The share resides in a NAS device. If I try the same script on the same computer, but change the connection to a share that resides on a regular server, it works.

Response seems adequate, but I'll run some wire shark to see if there is any latency or other traffic.

I added the space as you suggested, but this really made no difference, the script does work on other remote network sites. It is just this one site that has the problem.

Continuing to dig....

Thank you very much for your suggestions.

Share this post

Link to post
Share on other sites

Issue solved!

I am posting the resolution in case it might help others.

Server logs showed the following KRB error during script run: KRB5KRB_AP_ERR_TKT_NYV.

This error occurs when the time between the client and authenticating server are out of synch. By default, Kerberos authentication uses a 5 minute "window" to prevent "play back" attacks. The remote time server (and the remote client) were off by 8 minutes from the local authentication server.

Synchronizing the time between the time services cured the problem.

Thank you.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...