CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2005
    Location
    germany
    Posts
    160

    GetComputerNameEx problem

    Hi All,

    I am searching code to find out the fully qualified computername like

    compi.subdomain.domain.corp

    of a) the local computer and
    b) a computer, which computer name (not fully qualified) I know.

    I tried the following code to solve a), but it only gives me the computername, no matter which switch I use in GetComputerNameEx.

    If I display the computer proberties, a domain name ( smthg.corp) is displayed and in the tcpip parameters I can also read a domain. But they are different (the latter one is location.smthg.corp).

    So: what exactly is the fqdn and how do I get it?

    thanks in advance,
    HoM

    Code:
    		
    
    		TCHAR szBuf[MAX_PATH] ={0};
    		DWORD dwSize = sizeof( szBuf);
    		GetComputerNameEx( ComputerNameDnsDomain, szBuf, &dwSize );
    		cout << _T("ComputerNameDnsDomain                 :") << szBuf << endl;
    		szBuf [0] =0;
    		dwSize = sizeof( szBuf);
    		GetComputerNameEx( ComputerNameDnsFullyQualified, szBuf, &dwSize);
    		cout << _T("ComputerNameDnsFullyQualified         :") << szBuf << endl;
    		szBuf [0] =0;
    		dwSize = sizeof( szBuf);
    		GetComputerNameEx( ComputerNameDnsHostname, szBuf, &dwSize );
    		cout << _T("ComputerNameDnsHostname               :") << szBuf << endl;
    		szBuf [0] =0;
    		dwSize = sizeof( szBuf);
    		GetComputerNameEx( ComputerNameNetBIOS, szBuf, &dwSize );
    		cout << _T("ComputerNameNetBIOS                   :") << szBuf << endl;
    		szBuf [0] =0;
    		dwSize = sizeof( szBuf);
    		GetComputerNameEx( ComputerNameNetBIOS, szBuf, &dwSize );
    		cout << _T("ComputerNameNetBIOS                   :") << szBuf << endl;
    		szBuf [0] =0;
    		dwSize = sizeof( szBuf);
    		GetComputerNameEx( ComputerNamePhysicalDnsDomain, szBuf, &dwSize);
    		cout << _T("ComputerNamePhysicalDnsDomain         :") << szBuf << endl;
    		szBuf [0] =0;
    		dwSize = sizeof( szBuf);
    		GetComputerNameEx( ComputerNamePhysicalDnsFullyQualified, szBuf, &dwSize);
    		cout << _T("ComputerNamePhysicalDnsFullyQualified :") << szBuf << endl;
    		szBuf [0] =0;
    		dwSize = sizeof( szBuf);
    		GetComputerNameEx( ComputerNamePhysicalDnsHostname, szBuf, &dwSize);
    		cout << _T("ComputerNamePhysicalDnsHostname       :") << szBuf << endl;
    		szBuf [0] =0;
    		dwSize = sizeof( szBuf);
    		GetComputerNameEx( ComputerNamePhysicalNetBIOS, szBuf, &dwSize);
    		cout << _T("ComputerNamePhysicalNetBIOS           :") << szBuf << endl;
    
    		getchar();

  2. #2
    Join Date
    Jan 2005
    Location
    germany
    Posts
    160

    Re: GetComputerNameEx problem

    Can someone move this to the networking area? Maybe somebody there could help ...

    regards
    HoM

  3. #3
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: GetComputerNameEx problem

    Ok, then...

    [ Redirected thread ]

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: GetComputerNameEx problem

    Look up EzAdScriptomatic by the MSGuys. It writes AD scripts. just like Scriptomatic2 writes VBS scripts for non-AD systems.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Jan 2005
    Location
    germany
    Posts
    160

    Re: GetComputerNameEx problem

    Look up EzAdScriptomatic by the MSGuys. It writes AD scripts. just like Scriptomatic2 writes VBS scripts for non-AD systems
    ?? Has this anything to do with the GetComputerNameEx Windows API ?

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured