Skip to main content
Solved

Display AD Computer Name in Self Service?

  • September 22, 2017
  • 2 replies
  • 0 views

Forum|alt.badge.img+12
  • Valued Contributor
  • 90 replies

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
View original
Did this topic help you find an answer to your question?

2 replies

mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • Answer
  • September 22, 2017

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

Forum|alt.badge.img+12
  • Author
  • Valued Contributor
  • 90 replies
  • September 22, 2017

Wow, thanks so much! That is just what I need.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings