Hello,
I am trying to make a Tree Control on Windows and am trying to figure out how to check for mounted network drives on a user’s computer. I installed the win32 module but I cannot seem to find any documentation on it, so therefore I don’t really understand how to use it.
My question is, “How do I see which network directories the user has mounted on their computer?”
Thank you again,
Scott
Hi Scott,
Hello,
I am trying to make a Tree Control on Windows and am trying to figure out how to check for mounted network drives on a user's computer. I installed the win32 module but I cannot seem to find any documentation on it, so therefore I don't really understand how to use it.
My question is, "How do I see which network directories the user has mounted on their computer?"
Thank you again,
Scott
It took me a few minutes, but I found my script that does this. Here you go (open source license, use at your risk, yada yada yada):
<code>
import win32net
for x in win32net.NetUseEnum(None, 0)[0]:
if x['local'] != '':
print x['local'], x['remote']
</code>
Note that this ONLY shows your mapped drives and what they may to. This does not show your "normal" drive letters.
There's a PyWin32 mailing list that I recommend too: python-win32 Info Page
And here's a link to their docs: http://docs.activestate.com/activepython/2.5/pywin32/win32_modules.html
Note that you can also use MSDN since the examples there can be translated almost directly into the PyWin32 syntax.
Here are a couple of other sites I have found helpful:
http://timgolden.me.uk/python-on-windows/
http://timgolden.me.uk/python/win32_how_do_i.html
That should get you going at any rate. Welcome to the wonderful world of Windows programming!
···
-------------------
Mike Driscoll
Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org