I needed to obtain the Fully Qualified Domain Name (FQDN) for a given NetBios domain name. Eg from MYDOMAIN to dc=mydomain,dc=local.

I did some tests with the TranslateName API and if you append a \ to the domain name it returns the FQDN.

Here is a short example:

var
  Buffer: array[0..MAX_PATH] of Char;
  nSize: DWORD;
begin
  nSize := Length(Buffer);
  ZeroMemory(@Buffer, SizeOf(Buffer));
  Win32Check(TranslateName(‘MYDOMAIN\’), NameSamCompatible, NameFullyQualifiedDN, Buffer, nSize))
end;

Related posts:

  1. Preventing Domain Group Policies from Applying