Posted on 07-11-2012 03:44 PM
Hello,
I'm using LyncSetup 1.2 (http://www.officeformachelp.com/lync/administration/setup-script/) to deploy Microsoft Lync, and at the end of the policy, I'd like to have the application open as the user. I'm using this script (modified for Lync):
#!/bin/bash
declare
-x UserName="$(/usr/bin/who | /usr/bin/awk '/console/{print $1;exit}')"
echo
"Derived Console username: $UserName"
declare
-x LoginWindowPID="$(/bin/ps -axww | /usr/bin/grep loginwindo[w] | /usr/bin/awk '/console/{print $1;exit}')"
echo
"Found PID: $LoginWindowPID"
/bin/launchctl
bsexec "${LoginWindowPID:?}" /usr/bin/sudo -u "$UserName" /usr/bin/open /Applications/Calculator.app
From https://jamfnation.jamfsoftware.com/discussion.html?id=4117
But I'm getting a Microsoft error message when the script runs in the policy. Does anyone have a suggestion for how I might successfully launch Microsoft Lync, as the user, at the end of the Lync deployment policy? Thanks.
Posted on 07-12-2012 02:36 PM
Try this without trying to account for running it under the user account. I can send this command as "root" from ARD and launch the application for someone who is logged in to the Mac.
open -a "/Applications/Microsoft Lync.app"
Posted on 02-26-2013 09:57 AM
The "open -a..." method no longer works when using Casper policy (even if it works with ARD), thank you Apple and your "sandbox" philosphy. :)
So where an application is deployed and needs to launch, we followed Greg Neagle and Jared Nichol's method of deploying a user launch agent (run once) along with the package. Dump the *.plist into $currentUser/Library/LaunchAgents/ and load it. It'll run, launch the app, and never run again.
Can't recommend Lingon X (just released) enough...
http://sometimesitmatters.com/post/42269751388/lingon-x-released
Don