in reply to Win32API::Net::GetDCName returns error code 87 for remote servers

Did a Google search for a line command utility to determine the domain controller for a system and the second answer at this link suggests using nltest. Although that documentation link on nltest indicates that it applies to Windows server OSes, I have found that command on Windows 7 and Windows 8.

Of course, if you wanted to use nltest as alternate solution, you will need to run this on the remote system. For that, you may want to check out psexec, which is part of the SysInternals set of tools. Basically psexec will let you run commands on remote Windows based systems.

  • Comment on Re: Win32API::Net::GetDCName returns error code 87 for remote servers

Replies are listed 'Best First'.
Re^2: Win32API::Net::GetDCName returns error code 87 for remote servers
by dt667 (Acolyte) on Apr 06, 2016 at 13:36 UTC

    The good news is nltest will work from the command line. The bad news is that it won't work from within perl. I've tried using

    @args = ("nltest", "\/server:BW2012R2", "\/dsgetdc:Testlab"); system(@args) == 0 or die "system @args failed: $?";

    Output:

    'nltest' is not recognized as an internal or external command, operabl +e program or batch file. system nltest /server:BW2012R2 /dsgetdc:Testlab failed: 256

    I've also tried to use IPC::Run and IPC::Cmd with similar results. How can I run the nltest cmd directly from the commandline, but not from within a perl script?

      use absolute path to nltest