Skip to main content
Question

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

  • August 7, 2011
  • 4 replies
  • 19 views

bentoms
Forum|alt.badge.img+35

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

bentoms
Forum|alt.badge.img+35
  • Author
  • Hall of Fame
  • September 8, 2011

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


Forum|alt.badge.img+4
  • Contributor
  • July 9, 2012

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
Forum|alt.badge.img+24
  • Legendary Contributor
  • July 9, 2012

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
Forum|alt.badge.img+35
  • Author
  • Hall of Fame
  • July 9, 2012

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

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