How to get read AD groups in applescript
Hi.
I'm trying to make a login applescript that work out if the current user is a member of an AD group.
I can get the username, but need to prepend it with "domain\"
I can do it with a shell script like this
export user=$(whoami) -- get the username
domain_user=$our_domain_name'\'$user -- prepend the domain and slash
dsmemberutil flushcache -- flush the cache
export answer="$(dsmemberutil checkmembership -U $domain_user -G group_name)"
if [[ "$answer" == *not* ]]
then
do some stuff here
fi
Ive tried putting this into applescript:
try
set user to do shell script "whoami"
set TheCommand to "dsmemberutil checkmembership -U " & "our_domain_name\\" & user & " -G group_name"
do shell script "dsmemberutil flushcache"
try
set Answer to do shell scriptTheCommand
end try
end try
But the shell command does not see the \. how can i get around the escape charater problem? The double slash does not work....
any clues?
Mac OS X (10.7.1)