Skip to main content
Question

Extension Attribute: Computer Names Matching AD Objects

  • August 14, 2013
  • 0 replies
  • 1 view

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!