Script needed for joining domain

Hi Everyone,

Does anyone know or have a script which will join Mac to windows domain? I am using AdmitMac application which binds my Mac machines (using Tiger/Leopard OS) to windows domain (manually) and I was wondering if this could be done by using simple apple script.

Thanks,

There are many scripts out there to join a Mac to AD. Having never used Admit Mac though I can’t tell you if it will interfere with it in any way. Apple provides all the command line tools though and they are easily used through a shell or applescript.

If you are looking to GUI script the AdmitMac interface than thats another story. I’ll check if they have a downloadable demo to try out later today.

Hi James,

They do have trial version of AdmitMac:

http://www.thursby.com/products/admitmac-eval.html

where would i find more info regarding command line tools for joining domain (is it using AdmitMac?)?

Thanks,

Here’s the AppleScript to open Directory Services and after making sure the correct initial options are set it opens the ADmitMac config window. Note this script was created and tested on Leopard.

activate application "Directory Utility"
tell application "System Events"
	tell process "Directory Utility"
		if exists button "Click the lock to make changes." of window "Directory Utility" then
			click button "Click the lock to make changes." of window "Directory Utility"
			tell application "System Events"
				keystroke "PASSWORD" as text
				keystroke return
				delay 0.3
			end tell
		end if
		if exists button "Show Advanced Settings" of window "Directory Utility" then
			click button "Show Advanced Settings" of window "Directory Utility"
		end if
		click button "Services" of tool bar 1 of window "Directory Utility"
		set theServices to get value of text field 1 of every row of table 1 of scroll area 1 of group 1 of window "Directory Utility"
		repeat with rowNum from 1 to (count theServices)
			if (get value of text field 1 of row rowNum of table 1 of scroll area 1 of group 1 of window "Directory Utility") is "ADmitMac" then exit repeat
		end repeat
		if not (get value of checkbox 1 of row rowNum of table 1 of scroll area 1 of group 1 of window "Directory Utility") as boolean then
			click checkbox 1 of row rowNum of table 1 of scroll area 1 of group 1 of window "Directory Utility"
		end if
		tell application "System Events"
			keystroke tab
			repeat rowNum - 1 times
				key code 125
			end repeat
		end tell
		click button 1 of group 1 of window "Directory Utility"
		(*
		The ADmitMac config code here
		*)
		if exists button "Click the lock to prevent further changes." of window "Directory Utility" then
			click button "Click the lock to prevent further changes." of window "Directory Utility"
			tell application "System Events" to keystroke return
		end if
		tell application "Directory Utility" to quit
	end tell
end tell

In regards to binding via a shell script no it does not utilize the functionality of the ADmitMac LDAP plugin.

Thanks James, This scripts opens the configuration windows for AdmitMac which has been very helpful.