Deploy an alias to every desktop

SteveSOE
New Contributor III

Hey all!

I'd like to have an alias that points to Self Service available on the desktop of all Macs across our fleet. 

I guess there are several ways of doing this. Just looking to get some ideas on what a quick and easy method would be.

Thanks!

2 ACCEPTED SOLUTIONS

scottb
Honored Contributor

I simply made a policy to do this. Added under "Files and Processes":

ln -s /Applications/Self\ Service.app ~/Desktop

  

View solution in original post

SteveSOE
New Contributor III

I went with this in the end: created a script and got the policy to deploy it. The script contents being:

#!/bin/sh
sudo -u $3 ln -s /Applications/Self\ Service.app /users/$3/Desktop

The key thing here being the $3 parameter, which Jamf defines as the current logged on user.

Thanks for the assistance, jamfers!

View solution in original post

8 REPLIES 8

karthikeyan_mac
Valued Contributor

@SteveSOE . You can test and try.

For currently logged in user

loggedinuser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
cp -R "/Users/Shared/IBM/IBM i Access" /Users/$loggedinuser/Desktop/

 

For all users

Exsiting Users
for userLogged in $(/bin/ls /Users | sed -e '/Shared/d' -e '/Deleted Users/d' -e '/.localized/d'
-e '/.DS_Store/d' -e '/.com.apple.timemachine.supported/d' -e '/Adobe/d' -e '/Library/d');

do
ln -s /Applications/Self\ Service.app /Users/$userLogged/Desktop/SelfService
chown -R $userLogged:staff /Users/$userLogged/Desktop/SelfService
done

Future Users
ln -s /Applications/Self\ Service.app /System/Library/User\ Template/English.lproj/Desktop/SelfService
/usr/sbin/chown -R root:wheel /System/Library/User\ Template/English.lproj/Desktop/SelfService

 

Thanks

 

scottb
Honored Contributor

I simply made a policy to do this. Added under "Files and Processes":

ln -s /Applications/Self\ Service.app ~/Desktop

  

piotrr
Contributor III

I thought Files and Processes ran as root user, but you're saying ~/Desktop still points to the currently logged in user's desktop? 

scottb
Honored Contributor

I made a policy real quick after reading this and it works fine... literally took a couple minutes, so try it!

SteveSOE
New Contributor III

It didn't work for me. The logs tell me it has completed but there is no Alias on the desktop.

I think @piotrr may be correct and the command is running as root user, as the logs show this:

Executing Policy Self Service Alias
Running command ln -s /Applications/Self\ Service.app ~/Desktop...
Result of command:
ln: /var/root/Desktop/Self Service.app: File exists

scottb
Honored Contributor

Well, it is working here, and based on the log entry above, there's already one on the desktop, hence it failed.

I saw the same if I re-ran it as-is, so not sure why I can use it here and you can't.  I honestly thought it would not work for the reason above, but it does... ¯\_(ツ)_/¯

Either way, glad you got it sorted...👍

SteveSOE
New Contributor III

Maybe because I'm using an AD account to login to my Mac? Not sure myself.

Like you say, at least it's sorted... and for anyone looking at this article in future, there's a couple of tried-and-tested options to try! 

Thanks for the assist, I wouldn't have known where to begin otherwise.

SteveSOE
New Contributor III

I went with this in the end: created a script and got the policy to deploy it. The script contents being:

#!/bin/sh
sudo -u $3 ln -s /Applications/Self\ Service.app /users/$3/Desktop

The key thing here being the $3 parameter, which Jamf defines as the current logged on user.

Thanks for the assistance, jamfers!