Script only shows command completion message
2 posts · Closed
I'm doing some tests 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 shows 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:?)
It looks like you have forgotten the space here:
proc.execute("nltest /Server:" & Input.Current & "[color=#FF0000]␣[/color]/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