[python-win32] Find IP address for a UNC path

Dave Angel davea at dejaviewphoto.com
Thu Aug 27 10:52:19 CEST 2009


I'd like to be able to figure out the IP address for a Windows XP file 
server (on a local subnet, not across the Internet), based on a 
successfully connected share.

So I know the UNC name of the share, for example
    \\server\sharename\...

(which was enabled by a NET USE to some other share on the same server)

I know the IP address will be of the form  192.168.1.nnn   and it's on 
the same router as my user's machine.  The local machines are running XP 
and Vista (and OS-X), on a workgroup, not a domain.  And the server uses 
DHCP (I think it's called), so the IP address is not fixed over time.

The user of this utility will be then doing a Remote Desktop to the 
server, if that helps.  We know he has permission, since he was able to 
successfully  NET USE to the server.  But Remote Desktop doesn't seem to 
permit him to use the server name, only the IP address.

I've successfully written such a utility, using subprocess to launch 
IPCONFIG.EXE on the server, but I need to be able to do it from the 
user's machine, when the server is physically inaccessible.

Suggestions anyone?

Thanks, DaveA




More information about the python-win32 mailing list