NetUseAdd mystery

K

king kikapu

Is anyone see any error in the following code:

mapDrive = "\\\\MyServer\\C$"
data = {'remote' : mapDrive, 'local' : 'M:', 'password' :
'mypassword', 'user' : 'Administrator', 'asg_type' : 0}
win32net.NetUseAdd(None, 1, data)

It gives me "pywintypes.error: (1326, 'NetUseAdd', 'Logon failure:
unknown user name or bad password.')" and i cannot figured out why...I
searched the forum about the syntax of NetUseAdd command and i think
that the syntax is correct and also are the data that i pass to it.
(the same data can give me a connection if i use "net use ..." from a
command line"

So, what am i doing the wrong way (and keeps me on this the last 2
hours??...)


Thanks for a any enlightenment...
 
L

Larry Bates

king said:
Is anyone see any error in the following code:

mapDrive = "\\\\MyServer\\C$"
data = {'remote' : mapDrive, 'local' : 'M:', 'password' :
'mypassword', 'user' : 'Administrator', 'asg_type' : 0}
win32net.NetUseAdd(None, 1, data)

It gives me "pywintypes.error: (1326, 'NetUseAdd', 'Logon failure:
unknown user name or bad password.')" and i cannot figured out why...I
searched the forum about the syntax of NetUseAdd command and i think
that the syntax is correct and also are the data that i pass to it.
(the same data can give me a connection if i use "net use ..." from a
command line"

So, what am i doing the wrong way (and keeps me on this the last 2
hours??...)


Thanks for a any enlightenment...

I think your problem is that C$ is a "special" share. Try creating
a share and connect to it instead. It is either that your your userid/
password are in fact incorrect.

-Larry
 
K

king kikapu

I think your problem is that C$ is a "special" share. Try creating
a share and connect to it instead. It is either that your your userid/
password are in fact incorrect.

-Larry

No, my credentials are absolutely correct. As for the "$", what is the
possible problem with that ?? Net use is working great and i think
that also the net functions of win32api are working correct.
The problem must be in some other point...
 
R

Roger Upole

king said:
Is anyone see any error in the following code:

mapDrive = "\\\\MyServer\\C$"
data = {'remote' : mapDrive, 'local' : 'M:', 'password' :
'mypassword', 'user' : 'Administrator', 'asg_type' : 0}
win32net.NetUseAdd(None, 1, data)

It gives me "pywintypes.error: (1326, 'NetUseAdd', 'Logon failure:
unknown user name or bad password.')" and i cannot figured out why...I
searched the forum about the syntax of NetUseAdd command and i think
that the syntax is correct and also are the data that i pass to it.
(the same data can give me a connection if i use "net use ..." from a
command line"

So, what am i doing the wrong way (and keeps me on this the last 2
hours??...)


Thanks for a any enlightenment...


You need to use level 2 info to pass the username.
Level 1 is for the old-style share with its own password.
Also, it should be 'username': instead of just 'user':.

hth
Roger
 
K

king kikapu

You need to use level 2 info to pass the username.
Level 1 is for the old-style share with its own password.
Also, it should be 'username': instead of just 'user':.

hth
Roger

Roger many-many thanks! That was it, i had to put "username" instead
of "user" and 2 instead of 1 at the calling...

Thanks again!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,238
Latest member
Top CryptoPodcasts

Latest Threads

Top