Link to home
Start Free TrialLog in
Avatar of patriots
patriots

asked on

Find logon server of remote host

I would like to simply find out what domain controller a remote workstation that is logged onto the network is binding to.  I believe this would be the %logon server% variable.  I'd prefer to use PowerShell to do this...and it'd be nice to use a text file of workstations as a reference point.  VB script would also do.  I'm a novice at these scripting methods.

Thanks!
Avatar of Krzysztof Pytko
Krzysztof Pytko
Flag of Poland image

Please try to use this syntax (you need to have enabled WinRM on remote host)

 
invoke-command -computername <ComputerName -credential DomainName\AdminUser -scriptblock {dir $env:logonserver}

Open in new window


and for text file (put there computer names, one by line)

 
get-content c:\comps.txt | %{invoke-command -computername $_ -credential DomainName\AdminUser -scriptblock {dir $env:logonserver} }

Open in new window


Regards,
Krzysztof
OK, doesn't work. Forget about this syntax :/

Wait for other experts. Thanks

Krzysztof
ASKER CERTIFIED SOLUTION
Avatar of Krzysztof Pytko
Krzysztof Pytko
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial