Does anyone have a script they'd be willing to share to display the computer's Active Directory name in Self Service? I've tried writing my own script and it's a challenge that exceeds my meager scripting abilities.
In case that's not clear, I'm looking for something along the lines of the scripts posted in this thread that displays the "Computer ID" in AD, instead of the IP address and ComputerName.
Best answer by mm2270
Something like this?
#!/bin/bash
ADCompName=$(dsconfigad -show | awk -F'= ''/Computer Account/{print $NF}')
if [[ ! -z "$ADCompName" ]]; then
text="Your Active Directory computer name is:
$ADCompName"else
text="Your Mac is not joined to Active Directory"fi
/usr/bin/osascript << EOD
set diagText to (do shell script "echo "$text"")
tell application "System Events"
display dialog diagText buttons {"OK"}
end tell
EOD
#!/bin/bash
ADCompName=$(dsconfigad -show | awk -F'= ''/Computer Account/{print $NF}')
if [[ ! -z "$ADCompName" ]]; then
text="Your Active Directory computer name is:
$ADCompName"else
text="Your Mac is not joined to Active Directory"fi
/usr/bin/osascript << EOD
set diagText to (do shell script "echo "$text"")
tell application "System Events"
display dialog diagText buttons {"OK"}
end tell
EOD
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.