dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Netbios hostname (via IP)

  1. #1
    Join Date
    Mar 2019
    Posts
    2

    Netbios hostname (via IP)

    Hi,

    i'm looking for a function / method to get the Netbios name from every device in my network. In the most examples, or what I found, it's just the DNS hostname. In the example via GetComputerNameExA (https://docs.microsoft.com/en-us/win...omputernameexa) there is a difference between the DNS hostname and the Netbios name - unfortunately this function works only local pc. The function getnameinfo (via socket) returns the DNS hostname and not the Netbios name what I need - maybe there is another or additional solution for that?

    Thanks in advance.

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    6,608

    Re: Netbios hostname (via IP)

    The Netbios name and the DNS name are separate. Often the Netbios name is part of the DNS name but it needed be.

    AFAIK there is no function which returns the Netbios name of a remote computer.

    This can be done via remote registry calls - but this needs certain admin permissions and the remote computers need to be able to accept remote registry access calls. if you have admin level access to all the networked computers then this can be done - with the security downside that their registry to accessible remotely.

    Another option is to write a service that resides on every computer and which when requested provides the netbios name (and any other required info) via some secure IPC mechanism.

    But in both these scenarios there's changes required to the computers in the network for which you wish to interrogate.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2017 (15.9.9)

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,933

    Re: Netbios hostname (via IP)

    Look into using WMI (Windows Management Instrumentation).

  4. #4
    Join Date
    Mar 2019
    Posts
    2

    Re: Netbios hostname (via IP)

    Thanks for the answers. I found a solution via socket.

  5. #5
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,297

    Re: Netbios hostname (via IP)

    Quote Originally Posted by carre View Post
    Thanks for the answers. I found a solution via socket.
    Could you share the solution?
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)