Skip to main content
Question

Find user's current or last logon server (domain controller)

  • July 13, 2018
  • 1 reply
  • 9 views

Forum|alt.badge.img+13

I'm writing a script that that requires to know what office they are in without hardcoding ip etc.

Anyone know how to get the logon server? I've seen alot of ways that no longer work. The current working method I have is running: netstat | grep 63657

then pulling the data i want. Is there a cleaner method?

1 reply

Forum|alt.badge.img+5
  • New Contributor
  • July 16, 2018

Not sure if this helps, but it's what I use here:

"/usr/libexec/PlistBuddy" -c "print 'last used servers:/Active Directory/AD:host'" "/Library/Preferences/OpenDirectory/DynamicData/Active Directory/AD.plist" ;
"/bin/date" ;
"/usr/sbin/systemsetup" -getusingnetworktime -getnetworktimeserver ;