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();
Re: GetComputerNameEx problem
Can someone move this to the networking area? Maybe somebody there could help ...
regards
HoM
Re: GetComputerNameEx problem
Ok, then...
[ Redirected thread ]
Re: GetComputerNameEx problem
Look up EzAdScriptomatic by the MSGuys. It writes AD scripts. just like Scriptomatic2 writes VBS scripts for non-AD systems.
Re: GetComputerNameEx problem
Quote:
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 ?
:confused: