gibt es eine bessere Lösung als via nslookup ? was mir fehlt : code für NslookupOutput := ExecuteCommand('nslookup ' + Servername); aktueller code spielt nicht
Delphi-Quellcode:
uses
SysUtils, Classes, Windows;
function GetServernamesAliasList(Servername: string): string;
var
NslookupOutput: string;
AliasList: TStringList;
Line: string;
begin
NslookupOutput := ExecuteCommand('nslookup ' + Servername);
AliasList := TStringList.Create;
try
AliasList.Delimiter := #13#10;
AliasList.StrictDelimiter := True;
AliasList.DelimitedText := NslookupOutput;
for Line in AliasList do
begin
// Parse the output to extract aliases (if needed)
// Example: "Aliases: alias1, alias2, alias3"
// Extract the aliases after "Aliases: "
end;
// Join the aliases into a comma-separated string
Result := AliasList.DelimitedText;
finally
AliasList.Free;
end;
end;