Pushing a website http file to populate on the desktop on all user in Active directory

ybai9
New Contributor II

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? 

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

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.

Screen Shot 2022-05-11 at 5.12.26 PM.png

View solution in original post

3 REPLIES 3

mm2270
Legendary Contributor III

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.

Screen Shot 2022-05-11 at 5.12.26 PM.png

ybai9
New Contributor II

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?

mm2270
Legendary Contributor III

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.

Screen Shot 2022-05-19 at 10.55.19 AM.png