Automount SMB Share from multiple servers

dbodnar
New Contributor

Hi Guys, ive searched through the forums as much as i can and i think it might be easier just to ask for help on this one. Ive got 3x AD security groups that is populated with members. Each one of these security groups holds the membership of the users reflecting the shares that are located on the corresponding server.

E.G.
storage3.domain.com_SMB(security group) contains members who have shares located on storage3.domain.com (server)
storage4.domain.com_SMB(security group) contains members who have shares located on storage4.domain.com (server)
storage5.domain.com_SMB(security group) contains members who have shares located on storage5.domain.com (server)

As we have just started using Casper previously we used to do all our automounts via AppleScript by creating a login item via workgroup manager. We would copy the Applescript Automount.app to a location on the client and trigger the .app via workgroup manager. This script did infact trigger the 3x security groups and worked perfectly.

Below is my code that i used in my Apple Script but from what im reading on the forums i wont be able to use this for two reasons. Casper doesnt like AppleScripts plus even if i got it to work, doesnt Casper run this as the root user? Not as the logged in User?

Also all our share names that we have created we additionaly add "_fsdstorage" to the end of them E.G. $user_fsdstorage

Apple Script Below

set CurrentUser to (short user name of (system info))
try set user to do shell script "whoami" set TheCommand to "dsmemberutil checkmembership -U " & CurrentUser & " -G Storage3.domain.com_SMB" do shell script "dsmemberutil flushcache" try set Answer to do shell script TheCommand end try try if Answer is equal to "user is a member of the group" then mount volume "smb://storage3.domain.com/" & CurrentUser & "_fsdstorage$" end if end try
end try

try set user to do shell script "whoami" set TheCommand to "dsmemberutil checkmembership -U " & CurrentUser & " -G Storage4.domain.com_SMB" do shell script "dsmemberutil flushcache" try set Answer to do shell script TheCommand end try try if Answer is equal to "user is a member of the group" then mount volume "smb://storage4.domain.com/" & CurrentUser & "_fsdstorage$" end if end try
end try

try set user to do shell script "whoami" set TheCommand to "dsmemberutil checkmembership -U " & CurrentUser & " -G Storage5.domain.com_SMB" do shell script "dsmemberutil flushcache" try set Answer to do shell script TheCommand end try try if Answer is equal to "user is a member of the group" then mount volume "smb://storage5.domain.com/" & CurrentUser & "_fsdstorage$" end if end try

end try

End Script

Basically im looking at my options and im not sure what is the best what to go from here. Is there anyone out there that might be able to help?

4 REPLIES 4

Chris
Valued Contributor

dbodnar
New Contributor

Thanks Chris, But if i had to get this working in AppleScript, can i push this out through Casper? I noticed that Casper Admin only allows .applescript text files to be uploaded.

Chris
Valued Contributor

With the above solution, the script is triggered on every login by a LaunchAgent, not by Casper.
All you do is create your AppleScript and LaunchAgent, package them up and deploy them.
There's no recurring policy that runs the AppleScript itself.

davidacland
Honored Contributor II
Honored Contributor II

Same for us. AppleScript and LaunchAgent would work. We use bash most of the time but there is more work needed to capture the right username. We noticed root posing up as $USER a lot more often in Mavericks.