• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 790
  • Last Modified:

Apple Script to mount drives based on users AD group membership

I have created an script that mounts drives users need but I have have to add each share in the script. I am looking for a script that looks at the users group membership and then mounts the share if they are a member of that group/share.

Thanks
0
keevern
Asked:
keevern
  • 2
1 Solution
 
Eoin OSullivanConsultantCommented:
See this posting ... on EE
http://www.experts-exchange.com/Apple/Operating_Systems/OS_X/OS_X_Server/Q_27317949.html

The command "whoami" gives your current username
The command "groups" will give you a list of groups you are a member of
You could SCAN the list of groups .. if it finds a match you can execute a SMB mount command.
0
 
EdTechyCommented:
Login scripts execute as the root user and therefore "whoami" and "groups" return  information for root. To get the actual user logging in you need to execute the following in your script:
username=`eval echo $1`.
Unfortunately, I am not sure what you could do for the group info.
0
 
keevernAuthor Commented:
--do shell script "id"
set thescript to "id"
set userinfo to do shell script thescript

if (userinfo contains "AD group name") then
      mount volume "smb://server/share"
end if
0
 
keevernAuthor Commented:
Figured this out. You can also use.
set user_name to (short user name of (system info)) to get the local logged in user.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now