Jump to content

Drivemapadd problem


kenz
 Share

Recommended Posts

Any ideas why the drive map doesn't work? It returns an error code of 1

$user = InputBox("Security Check", "Enter your USERID.", "")
 $password = InputBox("Security Check", "Enter your password.", "", "*")
   
    Local $domain = 'XX'
    
   RunAsSet($user, $domain, $password)
   DriveMapDel("j:")
   DriveMapAdd("j:", "\\xxxxxxxx\xxx\xxxxxx", 0, "$domain\$user", "$password")
Link to comment
Share on other sites

Any ideas why the drive map doesn't work? It returns an error code of 1

$user = InputBox("Security Check", "Enter your USERID.", "")
 $password = InputBox("Security Check", "Enter your password.", "", "*")
   
    Local $domain = 'XX'
    
   RunAsSet($user, $domain, $password)
   DriveMapDel("j:")
   DriveMapAdd("j:", "\\xxxxxxxx\xxx\xxxxxx", 0, "$domain\$user", "$password")

:)

Edited by PsaltyDS
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
Link to comment
Share on other sites

Any ideas why the drive map doesn't work? It returns an error code of 1

$user = InputBox("Security Check", "Enter your USERID.", "")
 $password = InputBox("Security Check", "Enter your password.", "", "*")
   
    Local $domain = 'XX'
    
   RunAsSet($user, $domain, $password)
   DriveMapDel("j:")
   DriveMapAdd("j:", "\\xxxxxxxx\xxx\xxxxxx", 0, "$domain\$user", "$password")

Try the following code:

Local $domain = "DOMAIN"
$user = InputBox("Security Check", "Enter your USERID.", "")
$password = InputBox("Security Check", "Enter your password.", "", "*")
$remote_share = InputBox("Security Check", "Enter Network Resource", "\\server\resource$")

$domain_and_user = $domain & "\" & $user
DriveMapDel("J:")
Sleep(2500)
DriveMapAdd("J:", $remote_share, 0, $domain_and_user, $password)

Code has been tested.. worked with my Domain & Resources..

Edited by DJ VenGenCe
Link to comment
Share on other sites

Your "$domain\$user" parameter would be: $domain & "\" & $user

And, your "$password" would be just: $password (without the quotes)

DriveMapAdd("j:", "\\xxxxxxxx\xxx\xxxxxx", 0, $domain & "\" & $user", $password)

:)

Well the runasset is being used for some code below the mapping that I didn't include because it wasn't pertinent. I tried your suggestion with the $domain & "\" & $user, $password but it produces the same result. Error code 1

Link to comment
Share on other sites

Well the runasset is being used for some code below the mapping that I didn't include because it wasn't pertinent. I tried your suggestion with the $domain & "\" & $user, $password but it produces the same result. Error code 1

Should have worked if you corrected it to:

$user = InputBox("Security Check", "Enter your USERID.", "")
$password = InputBox("Security Check", "Enter your password.", "", "*")
   
Local $domain = 'XX'
   
DriveMapDel("j:")
DriveMapAdd("j:", "\\xxxxxxxx\xxx\xxxxxx", 0, $domain & "\" & $user, $password)

Are you using Win2K or later? WinNT and below would not map to a subdirectory of the share.

:)

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
Link to comment
Share on other sites

XP pro sp2

When you said "...the same result. Error code 1." Did you mean you tested @error and got 1, or just the return from the DriveMapAdd() function? Because most AutoIT functions, unlike bassackwards DOS, returns 1 for correct operation. Could you post enough of the script for us to see how you got the error code from it? :)

An example of saving the return codes:

$RetCode = DriveMapAdd("j:", "\\xxxxxxxx\xxx\xxxxxx", 0, $domain & "\" & $user, $password)
$ErrSav = @Error
$ExtSav = @Extended
MsgBox(64, "Debug", "Results of DriveMapAdd():" & @CRLF & "Return = " & $RetCode & @CRLF & "@Error = " & $ErrSav & @CRLF & "@Extended = " & $ExtSav)

:P

P.S. Note that my stand-alone DriveMapAdd() line of code in post #2 has a stray " after the $user. Sorry.

Edited by PsaltyDS
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
Link to comment
Share on other sites

$user = InputBox("Security Check", "Enter your USERID.", "")
 $password = InputBox("Security Check", "Enter your password.", "", "*")
   
    Local $domain = 'xx'
    
   RunAsSet($user, $domain, $password)
   DriveMapDel("j:")
   $map = DriveMapAdd ("j:", "\\xxxxxxx\xxx\xxxxxxx", 0, $domain & "\" & $user, $password)
MsgBox("","",@error);Display error

Edited by kenz
Link to comment
Share on other sites

$user = InputBox("Security Check", "Enter your USERID.", "")
 $password = InputBox("Security Check", "Enter your password.", "", "*")
   
    Local $domain = 'xx'
    
   RunAsSet($user, $domain, $password)
   DriveMapDel("j:")
   $map = DriveMapAdd ("j:", "\\xxxxxxx\xxx\xxxxxxx", 0, $domain & "\" & $user, $password)
MsgBox("","",@error);Display erroroÝ÷ Ûú®¢×£ajÝý±©ç£(§¡#fëmx-ëì"¶ayú%"(uè"Úò¶¬zØ^Ó~¢f¢p¢¹,Â+a§¢éí±©Ýué^¶)පߧh¨§­çÞ­éÜy»­}¨¥³­Ø^Ó~¢f¢êë¢

Starting to feel a stupid "DOH!" moment sneaking up on me now... :)

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
Link to comment
Share on other sites

Now that's annoying... :P

I'm getting the same with the following code, if I try to use the $domain. It works with local accounts and deleting the $domain reference, but fails with the $domain, @error = 1.

$user = InputBox("Security Check", "Enter your USERID.", "")
$password = InputBox("Security Check", "Enter your password.", "", "*")

$domain = "MyDomain"
$netdir = "\\MyServer\MyShare\MyFolder"
DriveMapDel("J:")
$RetCode = DriveMapAdd("j:", $netdir, 0, '"' & $domain & "\" & $user & '"', $password)
$ErrSav = @error
$ExtSav = @extended
$DebugMsg = "Return = " & $RetCode & @CRLF & "@Error = " & $ErrSav & @CRLF & "@Extended = " & $ExtSav
If FileExists("J:\") Then
    MsgBox(64, "Debug", "DriveMapAdd() succeeded for J:" & @CRLF & $DebugMsg)
Else
    MsgBox(64, "Debug", "DriveMapAdd() failed for J:" & @CRLF & $DebugMsg)
EndIf

Starting to feel a stupid "DOH!" moment sneaking up on me now... :)

So are we looking at a bug? Has anyone used this succesfully with the domain? I even tried to just hard code the login info and still have the same problem.

Link to comment
Share on other sites

So are we looking at a bug? Has anyone used this succesfully with the domain? I even tried to just hard code the login info and still have the same problem.

I have exactly the same problem and I'm looking for a solution since AutoIT 3.1.1.114. (Now using latest beta)

It worked perfect in Windows2000, but since I'm using Windows XP Pro this problem occurred.

When I map the same driveletter manually before running the AutoIT script, @Error returns 3, so that one's correct.

The problem I have is that when a correct username is set and an incorrect pasword is used, @Error returns 1 instead of 6!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...