Trouble Adding Computer Description In AD With Applescript

New Contributor

I'm hoping to find some help on what I am missing here.

So I have created an Applescript app that is designed to allow our local IT teams in different regions of the world to:

  1. Rename the computer using a specific standard set by the company
  2. Join/bind the computer to one of our AD domains and add it to a specific OU
  3. Set a specific string in the description field of the computer account in AD once it has been joined. 
  4. Open a webpage to start the process of enrolling in our MDM.

The app will prompt for input from the IT team member in order to perform the actions above. 

The app fails at #3 above.  The line in the Applescript related to this is as follows:

do shell script "/usr/bin/dscl -u " & domain_admin & " -P " & admin_password & " '/Active Directory/" & Sdomain_join & "/All Domains' -merge '/Computers/" & hostname & "$' Description '" & Sdomain_join & "\\" & AD_name & "'"

The variables in this line are of course part of the prompts from earlier in the script. When running the app, the message I receive when getting to this part is:

Syntax Error:   Data source (/Active Directory/domain/All Domains) is not valid.

The path and "domain" that is entered is for sure valid as I can run the same command in Terminal and it works.

Any ideas as to why this would be happening?