Skip to main content
Question

Extension Attribute help with Active Directory Query

  • October 16, 2012
  • 1 reply
  • 8 views

Forum|alt.badge.img+13

Seeking assistance with creating an extension attribute that will collect the following info:
For OS X 10.8
sudo defaults read /Library/Preferences/OpenDirectory/DynamicData/Active Directory/mydomain.plist | grep host

This command returns the "last used servers" for the Global Catalog server and domain server.

Can someone guide me with the best way to achieve this with an extension attribute? Also, how can I achieve the same for OS X lion?

1 reply

Forum|alt.badge.img+13
  • Contributor
  • October 16, 2012

If your "defaults read" is correct:

#!/bin/bash

lastGC=`sudo defaults read /Library/Preferences/OpenDirectory/DynamicData/Active Directory/mydomain.plist | grep host`
[ "${lastGC}" != "" ] && { echo "<result>${lastGC}</result>"; } || { echo "<result>None</result>"; }