Finding the logon server of remote machines

Started by rmpf2

rmpf2

Finding the logon server of remote machines   13 May 2025, 06:00

I'm doing some test trying to find the logon server of remote machines with the following script:
'This script is simply to display the logon server for remote computer

Set proc = Internal.CreateObject("process")
proc.execute("nltest /Server:" & Input.Current & "/dsgetdc:")

'Check exit code
If proc.ExitCode = 0 Then

    For Each line in proc.output
    Output.Write line
  Next
Else
  Output.Write "Exit code " & proc.ExitCode
End If
But I just saw the final part of the result, i.e. "The command completed successfully".

Example - The following show the whole result not just the last part
L:\>nltest /Server:pc1 /dsgetdc:
           DC: \\psrv1.cattle.local
      Address: \\10.300.10.12
     Dom Guid: 14a46226-293b-4dd9-9832-6b45a4f67d4a
     Dom Name: cattle.local
  Forest Name: cattle.local
 Dc Site Name: Default-First-Site-Name
Our Site Name: Default-First-Site-Name
        Flags: PDC GC DS LDAP KDC TIMESERV GTIMESERV WRITABLE DNS_DC DNS_DOMAIN DNS_FOREST CLOSE_SITE FULL_SECRET WS DS_8 DS_9
The command completed successfully
Any idea of why it did not show the whole result? Or how to overcome that to find the logon server (DC:)?
SoftPerfect Support forum - Andrew avatar image

Re: Finding the logon server of remote machines   13 May 2025, 10:28

It looks like you have forgotten the space here:
proc.execute("nltest /Server:" & Input.Current & "/dsgetdc:")
Without the space your comand was like this, which only prints "The command completed successfully":
C:\>nltest /server:someservername/dsgetdc:
The command completed successfully

Reply to this topic

Sometimes you can find a solution faster if you try the forum search, have a look at the knowledge base, or check the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • Write in English. If possible, check your spelling and grammar.

Author:

Email:

Subject

A brief and informative title for your message, approximately 4–8 words:

     

Spam prevention: please enter the following code in the input field below.

  *******   **    **  ********   *******   **     ** 
 **     **   **  **   **        **     **  **     ** 
 **     **    ****    **        **         **     ** 
  ********     **     ******    ********   **     ** 
        **     **     **        **     **   **   **  
 **     **     **     **        **     **    ** **   
  *******      **     ********   *******      ***    

Message: