Problem is im having problem outputting just Information Systems.
Can anyone help me?
Thanks
Best answer by stevewood
I just tried this and received the proper info back:
tell application "Finder"
set Department to do shell script "dscl /Active\\ Directory/INTEGERDALLAS/All\\ Domains/ -read /Users/swood dsAttrTypeNative:department | grep -oi 'information systems'"
display dialog Department
end tell
The trick for me were the double back slashes and then the single quote in the grep statement.
That returned "Information Systems" for my user, and when I tried a user that had a different department, it returned blank. For users that had no department it returned "No such key: dsAttrTypeNative:department".
Brilliant Steve. Im trying to get this in an applescript and having problems with it though. I have tried
set Department to do shell script "dscl /Active Directory/RUFUS_DOMAIN/All Domains/ -read /Users/tkimpton dsAttrTypeNative:department | grep -oi "Information Systems"
I just tried this and received the proper info back:
tell application "Finder"
set Department to do shell script "dscl /Active\\ Directory/INTEGERDALLAS/All\\ Domains/ -read /Users/swood dsAttrTypeNative:department | grep -oi 'information systems'"
display dialog Department
end tell
The trick for me were the double back slashes and then the single quote in the grep statement.
Thanks Steve much appreciated, you brought me back from the brinks of madness
This is what is used for the applescript in the end
set loggedInUser to do shell script "whoami"
set ISDepartment to do shell script "dscl /Active\\ Directory/RUFUS_DOMAIN/All\\ Domains/ -read /Users/" & loggedInUser & " dsAttrTypeNative:department | grep -oi 'Information Systems'"
hi do we have any updated script to update AD user full name department email id and more to update to inventory via extension attribute or policy can help