locked
Retrieve the server name RRS feed

  • Question

  • Hi all!

     

    What is the correct method to retrieve the IP Address of the server? Is there a built-in function in the Windows Home Server SDK?

     

    Thanks in advance.

    Tuesday, May 29, 2007 12:39 PM

Answers

  • Marco,

     

    The WHS server name (computer name, host name, etc.)  is set when you install WHS.  It defaults to "server".

     

    If you want to get the WHS server name and your code is running on a computer that has the WHS Connector installed, you could read the registry to the get the server name.  Look in HKLM\Software\Microsoft\Windows Home Server\Transport\Server.  Beware that registry settings could change in a future version of the Connector.

     

    Murray

    Wednesday, May 30, 2007 10:25 PM

All replies

  • Marco, there's nothing in the WHS API for this purpose. The capability is available through WMI, though.
    Tuesday, May 29, 2007 2:45 PM
    Moderator
  • Hi Ken!

     

    Thank you for the reply. I have seen the link you gave me. I think I might use the code that answers the question "...determine the IP address of a computer?", but my problem is that I don't kwnon what is the computer with Windows Home Server. Any idea?

     

    Thanks again!

    Tuesday, May 29, 2007 3:13 PM
  • Sorry, I thought you were looking to retrieve the server's IP address locally.

    I'm not sure how to do it today; if I recall correctly once upon a time you would use the NetBIOS networking APIs.
    Tuesday, May 29, 2007 6:07 PM
    Moderator
  • I would recommend that you use the WinSock API rather than NetBIOS.   Take a look at the GetAddrInfo function.  It's the recommended method because it's protocol independent and will work with IPv6.  Your code will have to know the host name of the WHS Server, e.g. "server".

     

    Is there a reason you need the IP address?  It's safer to write code that uses the hostname instead.

    Tuesday, May 29, 2007 7:24 PM
  • Hi!

     

    For my purpose, it is indifferent to retrieve the IP address or the server name. Do you know how to retrieve the name of the machine in which WHS is installed?

     

    Thanks again for your attention.

    Wednesday, May 30, 2007 10:14 AM
  • Marco,

     

    The WHS server name (computer name, host name, etc.)  is set when you install WHS.  It defaults to "server".

     

    If you want to get the WHS server name and your code is running on a computer that has the WHS Connector installed, you could read the registry to the get the server name.  Look in HKLM\Software\Microsoft\Windows Home Server\Transport\Server.  Beware that registry settings could change in a future version of the Connector.

     

    Murray

    Wednesday, May 30, 2007 10:25 PM
  • Hi!

     

    Thank you very much, It is what I was looking for!

    Wednesday, May 30, 2007 11:32 PM