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

Dave Angel davea at dejaviewphoto.com
Thu Aug 27 17:55:57 CEST 2009


I'll try PING when I next get to the location.

Steven James wrote:
> I think the bigger issue is being passed over...why write a program to do
> what RDP should already be able to do? RDP should work by machine name. If
> it does not, then DNS probably is not set up correctly.
>
>   
I don't know why RDP won't work by name;  I assumed it was because it's 
a workgroup setup, not a domain.  But your comment about DNS makes more 
sense.

There is no administrator for this system;  I have been trying to fake 
it (It's a non-profit, and I'm a volunteer), mostly by keeping things 
simple.  My only admin experience has been with a home network, though 
I've been involved in computer software for  40 years, and had computers 
at home for 30.  I don't know how to set up DNS on an XPPro system.  
This machine is a (file) server only in the sense that it's the only one 
with shares defined.  And it normally has no keyboard or monitor.  So 
RDP is the only easy way in.

> Are you, by any chance, using OpenDNS as your DNS servers?
>
> Does your router support DHCP assignment by MAC address (for static-like IPs
> with DHCP)? If so, you can always use the same IP instead of looking it up.
>   

Thanks, that would be perfect.  I guess it's got to be possible, since 
they have a shared printer that has a fixed IP.  But the printer setup 
software did it automatically.  The router is a plain-vanilla Linksys 
unit, but I'll be happy to get the password for it, and walk through its 
menus to see if I can make a static IP.

Thanks all of you.
DaveA
> Other than that, I second the "socket.gethostbyname" suggestion.
>
> SJ
>
>
> On Thu, Aug 27, 2009 at 9:35 AM, Gerdus van Zyl <gerdusvanzyl at gmail.com>wrote:
>
>   
>> I would say try socket.gethostbyname;
>> http://docs.python.org/library/socket.html#socket.gethostbyname
>>
>>
>> On Thu, Aug 27, 2009 at 2:59 PM, Dahlstrom,
>> Roger<rdahlstrom at directedge.com> wrote:
>>     
>>> Ping it and get the address.
>>>
>>> -----Original Message-----
>>> From: python-win32-bounces+rdahlstrom=directedge.com at python.org [mailto:
>>>       
>> python-win32-bounces+rdahlstrom <python-win32-bounces%2Brdahlstrom>=
>> directedge.com at python.org] On Behalf Of Dave Angel
>>     
>>> Sent: Thursday, August 27, 2009 4:52 AM
>>> To: Python-Win32 List
>>> Subject: [python-win32] Find IP address for a UNC path
>>>
>>> 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
>>>
>>>
>>> _______________________________________________
>>> python-win32 mailing list
>>> python-win32 at python.org
>>> http://mail.python.org/mailman/listinfo/python-win32
>>>
>>>
>>> DISCLAIMER:
>>> This e-mail, and any attachments thereto, is intended only for use by the
>>>       
>> addressee(s) named herein and
>>     
>>> may contain legally privileged and/or confidential information. If you
>>>       
>> are not the intended recipient
>>     
>>> of this e-mail, you are hereby notified that any dissemination,
>>>       
>> distribution or copying of this e-mail, and
>>     
>>> any attachments thereto, is strictly prohibited. If you have received
>>>       
>> this in error, please immediately notify
>>     
>>> me and permanently delete the original and any copy of any e-mail and any
>>>       
>> printout thereof.
>>     
>>> E-mail transmission cannot be guaranteed to be secure or error-free. The
>>>       
>> sender therefore does not accept
>>     
>>> liability for any errors or omissions in the contents of this message
>>>       
>> which arise as a result of e-mail transmission.
>>     
>>> NOTICE REGARDING PRIVACY AND CONFIDENTIALITY
>>> Direct Edge ECN LLC may, at its discretion, monitor and review the
>>>       
>> content of all e-mail communications.
>>     
>>> www.directedge.com
>>> _______________________________________________
>>> python-win32 mailing list
>>> python-win32 at python.org
>>> http://mail.python.org/mailman/listinfo/python-win32
>>>
>>>       
>> _______________________________________________
>> python-win32 mailing list
>> python-win32 at python.org
>> http://mail.python.org/mailman/listinfo/python-win32
>>
>>     
>
>   


More information about the python-win32 mailing list