views:

31

answers:

1

How can i manage to get the IP or path like \11.1.1.100\projects of a connected network share with a drive letter. I only have the drive letter and want to get the IP of the Share with python. Many Thanks... Sashmo

A: 

I don't know the python equivalent, but WNetGetConnection will give you the UNC path mapped to the drive letter:

wchar_t szName[256];
DWORD chName = 256;
DWORD dwResult = WNetGetConnectionW(L"Z:", szName, &chName);

I'm sure there is a python module that wraps this functionality. From the UNC path you can get the server name, and from that you can lookup its IP address.

Luke
thank you for your answer!Throug this WNetGetConnectionW i came across win32net for python and that did the trick.
Sashmo