AppleScript App: How To Map Drives & Printers Based On AD Group Membership On OSX

bentoms
Honored Contributor III
Honored Contributor III

In case anyone's interested: http://macmule.com/2011/08/07/how-to-map-drives-printers-based-on-ad-group-membership-on-osx/

4 REPLIES 4

bentoms
Honored Contributor III
Honored Contributor III

Updated to get the nodename from the users dscl record & then use quoted form.

So now working on 10.7 :) 

http://wp.me/p12A66-4a

thomasguidry
New Contributor

How are you getting the script to push from Casper?
Casper runs scripts as root so you can't get the logged on user by doing whoami.
Casper does have a few system variables it uses to push things to scripts that you run and logged in user is one of them "$3".
In bash you just set the script to say something like loggedinuser=$3 but how would you do that in an applescript?
(I tried set loggedInUser to do shell script "$3") and that didn't work.

mm2270
Legendary Contributor II

You're right. 'whoami' in a script run via Casper will return "root"
You can change that line to something like:

set loggedInUser to do shell script "/usr/bin/who | awk '/console/{print $1}'"

$3 will also work, but only for login triggers and via Self Service.

bentoms
Honored Contributor III
Honored Contributor III

I've used each of the 3 @ one point.

  1. LaunchAgent deployed via Casper
  2. MCX
  3. [Configuration profiles/li]