May 21, '08 07:30:01AM • Contributed by: RickoKid
ipconfig getoption en0 server_identifier
Needless to say, I can never remember the parameters for it, so I wrote an AppleScript to automate the process. With the script, you can also get the DHCP server for multiple interfaces at once as well. Here's the code:
I've tested it on Tiger (10.4) and Leopard (10.5), but it may work on older versions of Mac OS X, too. Due to the differences in systems older than Leopard however, the script can't look up the friendly interface name (Built-in Ethernet, AirPort, Firewire and so on), but lists the interface UNIX name (en0, en1, fw0 etc). It does make a wild guess at which interface it is, though, based on the usual assignments.
You can copy and paste the above into Script Editor and save it as an application, or download a ready-to-use version from this post on my site.
[robg adds: This script worked as described when I tested it.]
