Python Forum
Failing to connect by 'net use' - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Failing to connect by 'net use' (/thread-41998.html)



Failing to connect by 'net use' - tester_V - Apr-20-2024

Greetings to those that still up at this time! Wink
I'm failing to map network shares.
I'm identifying "letters not in use" for a share to mount and use it as a variable
and using a list of IPs to connect to.
Here is sniped:
import subprocess
drl  = 'A'  # Script identifies the letter not used for mounting shares
e_ip = '10.0.0.7' # IP from IP list
mp_string = f"net use {drl}:\\\\{e_ip}\\c$ /u:someuser somepassword"
print(f" -- {mp_string}")
subprocess.call(mp_string)
Could you help me with this?


RE: Failing to connect by 'net use' - tester_V - Apr-20-2024

My bad! Wink
I missed little space:

before:
"net use {drl}:\\\\{e_ip}\\c$ /u:someuser somepassword"
after:
"net use"+" "+drl+":"+" \\\\"+e_ip+"\\c$ /u:someuser somepassword"	
I'm OK now.
Thank you!