Skip to main content
Question

Extension Attribute: Computer Names Matching AD Objects


Forum|alt.badge.img+20
  • Valued Contributor
  • 732 replies

Hey all basically made a script for people with OCD like me who like the Sharing Names to match the AD Object Name. The first script I will post is just for reporting. Ill post another script that will fix any computers with mismatches. Essentially, make this script an Extension Attribute, Smart Group, and choose "Yes" for computers in compliance and "No" for computers that have mismatched names. Enjoy and feedback if you have a better way of making this work!!!!

#!/bin/sh

adObject=`dsconfigad -show | awk '/Computer Account/{print $NF}' | tr '[a-z]' '[A-Z]' | sed s/.$//`
sharingName=`scutil --get ComputerName`

if [ $adObject = $sharingName ] ; then
  echo "<result>Yes</result>"
else 
  echo "<result>No</result>"

fi

0 replies

Be the first to reply!

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