Sign in to follow this  
Followers 0
jp10558

DriveMapAdd fails on Windows 7 x64 to Samba

7 posts in this topic

I have a samba server and while net use works to map a drive with credentials, with my Autoit script using DriveMapAdd I only get an error, specifically 

 Undefined / Other error. Windows API, where @extended is set to 0.

I'm really running out of ideas, this used to work, but I'm not sure what the interaction issue may be. The big change was to a RHEL HA clustered samba service. I've tried everything I can find from Windows and Linux, and it seems to work with native tools at a logged in user at the command line. But if I then, with the same user, run a compiled autoit script to map the drive, it fails. It even fails if I do a 

RunWait("cmd /c net use X: servershare password /user:userName", "", @SW_HIDE) ...

note, if I do 

net use X: servershare password /user:userName

at the command line in the same session, it works.

I'm prefacing my attempts to map a drive with a DriveMapDel("x:") to avoid trying to map 2 times to the same drive letter...

Any ideas?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I'm not in an environment where I can play with network drives/printers, but I have a few questions for you:
 
1 - Is DriveMapDel a blocking function?  Maybe it's returning too soon?

2 - Try your script with DriveMapDel commented out.  If it works, you can try using DriveMapGet to check for a mapped drive before trying to delete it.

Edited by Artisan

Share this post


Link to post
Share on other sites

I actually was trying without the DriveMapDel initially and it was failing in the same way, so I added it in to clear out one of the potential causes I was aware of.

Share this post


Link to post
Share on other sites

Anyone?

Share this post


Link to post
Share on other sites

Why does the title say DriveMapAdd, but you're using "net use"? Which one are you actually having a problem with?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I've always had problems with mappings, and found the only way to work with them consistently, is to kill ALL mappings, and then add those that you need back in (if possible).

Net Use * /Delete /YES

Else, it's way to easy to get errors, like attempting to map 2 users to one share (ex: 2 drives), having the share present, but not active-failing on overwrite.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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