Posted on 05-10-2022 09:34 AM
Hi,
I have a google drive link that I made into a website HTTP file and I want to populate it on the desktop for all users who log in to our computers with their active directory account. What is the best way to go about this?
Solved! Go to Solution.
Posted on 05-11-2022 02:14 PM
Do you utilize the Self Service application in your environment? If so, it's probably easier to use a Self Service bookmark for this. It will always be there and can be easily pulled or updated at any time from the Jamf console. You can also add a brief description to it, something you can't really do with a weblink living on someone's Desktop.
But.... if you really want to go the route of using what's known as a "webloc" file, they can be created directly in a script and put anywhere you want to drop them. Something like this would work.
#!/bin/zsh
logged_in_user=$(/usr/sbin/scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ {print $3}')
webloc_filename="$4"
webloc_address="$5"
webloc_data='<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>URL</key>
<string>'$webloc_address'</string>
</dict>
</plist>'
cat << EOWEBLOC > "/Users/${logged_in_user}/Desktop/${webloc_filename}.webloc"
$webloc_data
EOWEBLOC
From a Jamf policy when running this script, you can supply a filename for the resulting webloc file, and the URL it will use in parameters 4 and 5, respectively. It should generate a .webloc file with the name and address you specified on the currently logged in user's Desktop. From there, double clicking the file should open the URL in their default browser.
Posted on 05-11-2022 02:14 PM
Do you utilize the Self Service application in your environment? If so, it's probably easier to use a Self Service bookmark for this. It will always be there and can be easily pulled or updated at any time from the Jamf console. You can also add a brief description to it, something you can't really do with a weblink living on someone's Desktop.
But.... if you really want to go the route of using what's known as a "webloc" file, they can be created directly in a script and put anywhere you want to drop them. Something like this would work.
#!/bin/zsh
logged_in_user=$(/usr/sbin/scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ {print $3}')
webloc_filename="$4"
webloc_address="$5"
webloc_data='<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>URL</key>
<string>'$webloc_address'</string>
</dict>
</plist>'
cat << EOWEBLOC > "/Users/${logged_in_user}/Desktop/${webloc_filename}.webloc"
$webloc_data
EOWEBLOC
From a Jamf policy when running this script, you can supply a filename for the resulting webloc file, and the URL it will use in parameters 4 and 5, respectively. It should generate a .webloc file with the name and address you specified on the currently logged in user's Desktop. From there, double clicking the file should open the URL in their default browser.
Posted on 05-18-2022 01:06 PM
The Webloc script worked great thank you!! Yes, we do utilize self-service and we did have it in bookmarks but found that users were not engaging in it so we want to move it to the desktop. Any advice on how to change the icon of the webloc file?
Posted on 05-19-2022 07:56 AM
Take a look at this utility - https://github.com/mklement0/fileicon
It's basically a script that you can deploy to your Macs as an executable, for example as /usr/local/bin/fileicon and then call in the script to apply an icon to the newly created webloc file. I just tested it on macOS 12.3.1 and it works. Can't speak for older OS versions right now, but if it works on Monterey it likely works on at least Big Sur if not older.