Jump to content
Sign in to follow this  
ViciousXUSMC

DriveMapAdd not working properly

Recommended Posts

ViciousXUSMC

I am trying to use the DriveMapAdd function and its just not working correctly for me.

I have dumbed down my script to be as simple as possible for testing purposes.

Currently:

DriveMapAdd("W:", "\\vtrendserver\ofcscan")

I am running this on windows 7 x64 on a Domain

Logged in as a domain user that has permission for this location already (as part of testing my end goal is to map this location for a local account and get prompted for domain credentials to gain access)

The script is not failing, it runs but the drive is not mapped.

The very interesting part is that during my troubleshooting when I went to go map the drive manually via the "Map network drive" from My Computer the W: is showing that its mapped in the drop down box and it made me verify I wanted to overwrite the current connection with my new one before it would proceed.

If I do map manually (Via cmd with Net Use or via the "Map network drive" dialog the Drive letter shows in my computer and I have access.  With only the AutoIt script even though I have this "invisible" mapped drive that does not show in My Computer I can not access the location even if typing in the location manually with the supposed drive letter.

So it seems that the function just is not working properly and not sure if this is a known issue or a limitation of it based on my environment. 

Screenshot attached showing the "Invisible" mapped drive left from AutoIt before I map it via other means. 

post-86705-0-38293400-1406653235_thumb.j

Share this post


Link to post
Share on other sites
JLogan3o13

What version of AutoIt are you using, first off. Also, what do you get on error checking when running the DriveMapAdd command?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
computergroove

Are you opposed to using the windows comspec?

Run(@ComSpec "net use Y: \\Server\C /User:acme /Pass:123")
Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites
JLogan3o13

While a workaround is always great, there is merit to using a native AutoIt function if it exists (otherwise why not suggest people go back to using batch files for everything ;) ).

I would think rather than abandoning DriveMapAdd as a solution, we would be better served helping the OP figure out why it is not operating as he expects.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Jos

 

Are you opposed to using the windows comspec?

Run(@ComSpec "net use Y: \\Server\C /User:acme /Pass:123")

Doubt that works without an & and a  /c in there . ;)


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
computergroove

Doubt that works without an & and a  /c in there . ;)

Run(@ComSpec & "/c" & "net use Y: \\Server\C /User:acme /Pass:123")

Sorry about that. I cannot find really solid documentation on the @ComSpec anywhere.

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites
Jos
Run(@ComSpec & "/c" & "net use Y: \\Server\C /User:acme /Pass:123")

Sorry about that. I cannot find really solid documentation on the @ComSpec anywhere.

Nearly correct .... just one mistake there left. ;)


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
ViciousXUSMC

Lol, I use @ComSpec for a few things.  Totally should have gone that as my temporary work around rather than calling to a bat file but forgot all about it.

I am using the newest version 3.3.12.0 and I have made sure my .exe is being run as Administrator. 

Share this post


Link to post
Share on other sites
computergroove

Run(@ComSpec & "/c net use Y: \\Server\C /User:acme /Pass:123")

I am trying to piece it together from this -> http://www.autoitscript.com/wiki/Snippets_%28_CMD_%29 but I am not 100% sure.

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites
Jos
Run(@ComSpec & "/c net use Y: \\Server\C /User:acme /Pass:123")

I am trying to piece it together from this -> http://www.autoitscript.com/wiki/Snippets_%28_CMD_%29 but I am not 100% sure.

Still one error in there ....  sorry for being a pain but think it would be nice when you propose stuff that works.

Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
ViciousXUSMC

What version of AutoIt are you using, first off. Also, what do you get on error checking when running the DriveMapAdd command?

 

No Error it passes with no @Error unless I run it more than once then I get Error 3 = Already Mapped

Share this post


Link to post
Share on other sites
JLogan3o13

Lol, I use @ComSpec for a few things.  Totally should have gone that as my temporary work around rather than calling to a bat file but forgot all about it.

I am using the newest version 3.3.12.0 and I have made sure my .exe is being run as Administrator. 

 

How about the error return when you run DriveMapAdd?

Edit: Missed your post while I was typing :)

@computergroove, just a suggestion, maybe another thread to assist you in getting @Comspec working, rather than overtaking the OP in this one...

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
computergroove

Run(@ComSpec & ' /c ' & "net use " & "Y: MYBOOKLIVEDUOPublic")

Had to setup a network share on another computer and play with it a bit. This one worked. Again is there better documentation on this?


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites
Jos

Run(@ComSpec & ' /c ' & "net use " & "Y: MYBOOKLIVEDUOPublic")

Had to setup a network share on another computer and play with it a bit. This one worked. Again is there better documentation on this?

Yes it does and I am regularly wondering why the hell many of you do this string concatenation with @comspec command lines.

Just simply do:

Run(@ComSpec & ' /c net use Y: \\MYBOOKLIVEDUO\Public')

So now let's get back to the topic at hand which is DriveMapAdd() issues the OP is having.

Thanks

jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  

×