Author Archive Dan Ashley

ByDan Ashley

SCRIPT | Install-Skype-Latest

Install Microsoft Skype

Summary

This script will install the latest version of Microsoft Skype.


Script Content

#!/bin/bash
cd "/Library/Application Support/JAMF/tmp"

# Update variables. These shouldn't need to change for each update
dmgname="getskype-macosx.dmg"
dmglink="http://www.skype.com/go/getskype-macosx.dmg"
dmgmountedname="Skype"
apptoreplace="Skype.app"
apptoreplacerunningname="Skype"

# Download DMG
curl -L -O "$dmglink"

# Mount DMG 
hdiutil mount -nobrowse $dmgname

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Copy the new version into the Applications Folder
cp -R "/Volumes/$dmgmountedname/$apptoreplace" /Applications

# Set the user as the current logged in user
netname=`ls -l /dev/console | cut -d " " -f 4`

chown -R ${netname}:Staff "/Applications/$apptoreplace"

sudo xattr -rc "/Applications/$apptoreplace/"

# Unmount the DMG
hdiutil unmount "/Volumes/$dmgmountedname"

# Remove the downloaded DMG
rm $dmgname

# Clear out the used variables
unset dmgname
unset dmglink
unset dmgmountedname
unset apptoreplace
unset apptoreplacerunningname
unset netname
exit 0

Concluding Comments

Microsoft Teams is essential communication tool for many users, this script allows you to know the latest version is always being deployed.

ByDan Ashley

SCRIPT | Install-Keka-Latest

Install Keka

Summary

This script will install the latest version of Keka.


Script Content

#!/bin/bash
cd "/Library/Application Support/JAMF/tmp"

# Update variables. These shouldn't need to change for each update
dmgname="Keka.dmg"
#dmglink="http://download.kekaosx.com/"
dmglink="https://d.keka.io/"
dmgmountedname="Keka"
apptoreplace="Keka.app"
apptoreplacerunningname="Keka"

# Download DMG
curl -L -o $dmgname "$dmglink"

# Mount DMG 
hdiutil mount -nobrowse $dmgname

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Copy the new version into the Applications Folder
cp -R "/Volumes/$dmgmountedname/$apptoreplace" /Applications

# Set the user as the current logged in user
netname=`ls -l /dev/console | cut -d " " -f 4`

chown -R ${netname}:Staff "/Applications/$apptoreplace"

sudo xattr -rc "/Applications/$apptoreplace/"

# Unmount the DMG
sudo hdiutil unmount "/Volumes/$dmgmountedname"

# Remove the downloaded DMG
rm $dmgname

# Clear out the used variables
unset dmgname
unset dmglink
unset dmgmountedname
unset apptoreplace
unset apptoreplacerunningname
unset netname
exit 0

Concluding Comments

This script will install the latest version of the Keka application for compressing and extracting files.

ByDan Ashley

SCRIPT | Install-Google-Drive-Latest

Install Google Drive

Summary

This script will install the latest version of the Google Drive desktop application.


Script Content

#!/bin/bash
cd "/Library/Application Support/JAMF/tmp"

# Update variables. These shouldn't need to change for each update
dmgname="googledrive.dmg"
dmglink="https://dl.google.com/drive-file-stream/googledrive.dmg"
dmgmountedname="Install Google Drive"
pkgname="GoogleDrive.pkg"
apptoreplace="Google Drive.app"
apptoreplacerunningname="Google Drive"

# Download DMG
curl -L -O "$dmglink"

# Mount DMG 
hdiutil mount -nobrowse $dmgname

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Install the new version by running the .pkg file
installer -pkg "/Volumes/$dmgmountedname/$pkgname" -target /

sudo xattr -rc "/Applications/$apptoreplace/"

# Set the user as the current logged in user
netname=`ls -l /dev/console | cut -d " " -f 4`

# User-enabled browser authentication for Google Drive
sudo -s -u $netname defaults write com.google.drivefs.settings ForceBrowserAuth -bool true

# Unmount the DMG
hdiutil unmount "/Volumes/$dmgmountedname"

# Remove the downloaded DMG
rm $dmgname

# Clear out the used variables
unset dmgname
unset dmglink
unset dmgmountedname
unset apptoreplace
unset apptoreplacerunningname
unset accounttype
unset pkgname
exit 0

Concluding Comments

The Google Drive desktop application makes sync’ing Google Drive contents to and from your Mac easier than ever.

ByDan Ashley

SCRIPT | Install-Firefox-Latest

Install Firefox

Summary

This script will install the latest version of Firefox.


Script Content

#!/bin/bash
cd "/Library/Application Support/JAMF/tmp"

# Update variables. These shouldn't need to change for each update
dmgname="Firefox.dmg"
dmglink="http://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US"
dmgmountedname="Firefox"
apptoreplace="Firefox.app"
apptoreplacerunningname="Firefox"

# Download DMG
curl -L -o $dmgname "$dmglink"

# Mount DMG 
hdiutil mount -nobrowse $dmgname

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Copy the new version into the Applications Folder
cp -R "/Volumes/$dmgmountedname/$apptoreplace" /Applications

# Set the user as the current logged in user
netname=`ls -l /dev/console | cut -d " " -f 4`

chown -R ${netname}:Staff "/Applications/$apptoreplace"

sudo xattr -rc "/Applications/$apptoreplace/"

# Unmount the DMG
hdiutil unmount "/Volumes/$dmgmountedname"

# Remove the downloaded DMG
rm $dmgname

# Clear out the used variables
unset dmgname
unset dmglink
unset dmgmountedname
unset apptoreplace
unset apptoreplacerunningname
unset netname
exit 0

Concluding Comments

Firefox is a common web browser often used as an alternative to either Google Chrome of Safari for macOS users. This script allows you to know the latest version is always being deployed.

ByDan Ashley

SCRIPT | Install-Figma-Latest

Install Figma

Summary

These scripts will install the latest version of Figma.

Please note there is 2 versions of the script. One is for installing the arm64 version of the application intended for Macs with an Apple Silicon CPU, the other script installs the x86_64 version of the app for Macs with an Intel CPU.


Script Content (for Apple Silicon CPU Macs – arm64)

#!/bin/bash
cd "/Library/Application Support/JAMF/tmp"

# Update variables. These shouldn't need to change for each update
zipname="Figma.zip"
ziplink="https://desktop.figma.com/mac-arm/Figma.zip"
apptoreplace="Figma.app"
apptoreplacerunningname="Figma"
apptoreplacerunningname="FigmaAgent"

# Download ZIP
curl -L -o $zipname "$ziplink"

# Remove any previous downloaded remnants
rm -rf $apptoreplace
rm -rf "__MACOSX"

# Unzip ZIP
unzip $zipname

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"
killall -Kill "$apptoreplacerunningname2"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Copy the new version into the Applications Folder
cp -R "$apptoreplace" /Applications

# Set the user as the current logged in user
netname=`ls -l /dev/console | cut -d " " -f 4`

chown -R ${netname}:Staff && chmod -R 755 "/Applications/$apptoreplace"

sudo xattr -rc "/Applications/$apptoreplace/"

# Remove the downloaded App
rm -rf $apptoreplace
rm -rf "__MACOSX"

# Clear out the used variables
unset zipname
unset ziplink
unset apptoreplace
unset apptoreplacerunningname
unset apptoreplacerunningname2
unset netname
exit 0

Script Content (for Intel CPU Macs – x86_64)

#!/bin/zsh
cd "/Library/Application Support/JAMF/tmp"

# Update variables. These shouldn't need to change for each update
zipname="Figma.zip"
ziplink="https://desktop.figma.com/mac/Figma.zip"
apptoreplace="Figma.app"
apptoreplacerunningname="Figma"
apptoreplacerunningname="FigmaAgent"

# Download ZIP
curl -L -o $zipname "$ziplink"

# Remove any previous downloaded remnants
rm -rf $apptoreplace
rm -rf "__MACOSX"

# Unzip ZIP
unzip $zipname

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"
killall -Kill "$apptoreplacerunningname2"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Copy the new version into the Applications Folder
cp -R "$apptoreplace" /Applications

# Set the user as the current logged in user
netname=`ls -l /dev/console | cut -d " " -f 4`

chown -R ${netname}:Staff && chmod -R 755 "/Applications/$apptoreplace"

sudo xattr -rc "/Applications/$apptoreplace/"

# Remove the downloaded App
rm -rf $apptoreplace
rm -rf "__MACOSX"

# Clear out the used variables
unset zipname
unset ziplink
unset apptoreplace
unset apptoreplacerunningname
unset apptoreplacerunningname2
unset netname
exit 0

Concluding Comments

Figma is a vector graphics editor and prototyping tool which is primarily web-based, with additional offline features enabled by the desktop application for macOS.

ByDan Ashley

SCRIPT | Install-Microsoft-Teams-Latest

Install Microsoft Teams

Summary

This script will install the latest version of Microsoft Teams.


Script Content

#!/bin/bash
cd "/Library/Application Support/JAMF/tmp"

# Obtain URL for PKG
teamsurl="https://teams.microsoft.com/downloads/DesktopUrl?env=production&plat=osx&arch=64"

# Update variables. These shouldn't need to change for each update
pkgname="Teams_osx.pkg"
pkglink=$(curl -s "$teamsurl")
apptoupdaterunningname="Microsoft Teams"

# Download PKG
curl -L -o "$pkgname" "$pkglink"

sleep 10

# Kill the app if it is running
killall -Kill "$apptoupdaterunningname"

# Install PKG
sudo installer -pkg $pkgname -target /

# Remove the downloaded PKG
rm $pkgname

# Clear out the used variables
unset teamsurl
unset pkgname
unset pkglink
unset apptoupdaterunningname
exit 0

Concluding Comments

Microsoft Teams is pretty much an essential application for any enterprise user these days, this script allow you to know the latest version is always being deployed.

ByDan Ashley

SCRIPT | Management-Update-User-Information

Update User Information

Summary

This script updates the assigned user in Jamf Pro based off who is logged in.


Script Content

#!/bin/bash

# Get the logged in users username
loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

echo "Running recon for $loggedInUser `date`..."
sudo jamf recon -endUsername $loggedInUser
echo "Finished running recon for $loggedInUser `date`..."

Concluding Comments

This task will assist with maintaining accurate records within Jamf Pro of which Mac is assigned to which user.

ByDan Ashley

SCRIPT | Install-Slack-Latest

Install Slack

Summary

This script will install the latest Universal version of Google Chrome.


Script Content

#!/bin/bash
cd "/Library/Application Support/JAMF/tmp"

# Update variables. These shouldn't need to change for each update
dmgname="Slack.dmg"
dmglink="https://slack.com/ssb/download-osx-universal"
apptoreplace="Slack.app"
apptoreplacerunningname="Slack"

# Download DMG
curl -L -o $dmgname "$dmglink"

# Mount DMG 
hdiutil mount -nobrowse $dmgname

#Slack DMG now has changing DMG name. Grab it on the fly as it's mounted
dmgmountedname=`ls /Volumes/ | grep "Slack"`

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Copy the new version into the Applications Folder
cp -R "/Volumes/$dmgmountedname/$apptoreplace" /Applications

# Set the user as the current logged in user
netname=`ls -l /dev/console | cut -d " " -f 4`

chown -R ${netname}:Staff && chmod -R 755 "/Applications/$apptoreplace"
  
sudo xattr -rc "/Applications/$apptoreplace/"

# Unmount the DMG
hdiutil unmount "/Volumes/$dmgmountedname"

# Remove the downloaded DMG
rm $dmgname

# Clear out the used variables
unset dmgname
unset dmglink
unset dmgmountedname
unset apptoreplace
unset apptoreplacerunningname
unset netname
exit 0

Concluding Comments

Slack is pretty much an essential application for any user these days, this script allow you to know the latest version is always being deployed.

As this script installs the Universal version of Slack, it will natively run on Macs with either Intel (x86_64) or Apple Silicon (arm64) CPUs.

ByDan Ashley

SCRIPT | Install-Dropbox-Latest

Install Dropbox

Summary

This script will install the latest version of Dropbox.


Script Content

#!/bin/bash
cd "/Library/Application Support/JAMF/tmp"

# Set variables. These shouldn't need to change for each update
dmgname="DropBoxInstaller.dmg"
dmglink="https://www.dropbox.com/download?full=1&plat=mac"
dmgmountedname="Dropbox Offline Installer"
apptoreplace="Dropbox.app"
apptoreplacerunningname="Dropbox"
apptorun="/Applications/Dropbox.app"

# Download DMG
curl -L $dmglink > $dmgname

# Mount DMG 
hdiutil mount -nobrowse $dmgname

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Copy the new version into the Applications Folder
cp -R "/Volumes/$dmgmountedname/$apptoreplace" /Applications

# Update permissions on the copied APP in Applications
netname=`ls -l /dev/console | cut -d " " -f 4`

chown -R ${netname}:Staff && chmod -R 755 "/Applications/$apptoreplace"

sudo xattr -rc "/Applications/$apptoreplace/"

# Unmount the DMG
hdiutil unmount "/Volumes/$dmgmountedname"

# Remove the downloaded DMG
rm $dmgname

# Complete application install and initial setup
open "$apptorun"

unset dmgname
unset dmglink
unset dmgmountedname
unset apptoreplace
unset apptoreplacerunningname
unset apptorun
unset netname

exit 0

Concluding Comments

The Dropbox desktop application makes sync’ing Dropbox contents to and from your Mac easier than ever.

ByDan Ashley

SCRIPT | Install-Dialpad-Latest

Install Dialpad

Summary

This script will install the latest version of Dialpad.


Script Content

#!/bin/bash
cd "/Library/Application Support/JAMF/tmp"

# Update variables. These shouldn't need to change for each update
dmgname="Dialpad.dmg"
dmglink="https://storage.googleapis.com/dialpad_native/osx/Dialpad.dmg"
dmgmountedname="Dialpad"
apptoreplace="Dialpad.app"
apptoreplacerunningname="Dialpad"

# Download DMG
curl -L -O "$dmglink"

# Mount DMG 
hdiutil mount -nobrowse $dmgname

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Copy the new version into the Applications Folder
cp -R "/Volumes/$dmgmountedname/$apptoreplace" /Applications

# Set the user as the current logged in user
netname=`ls -l /dev/console | cut -d " " -f 4`

chown -R ${netname}:Staff && chmod -R 755 "/Applications/$apptoreplace"

sudo xattr -rc "/Applications/$apptoreplace/"

# Unmount the DMG
hdiutil unmount "/Volumes/$dmgmountedname"

# Remove the downloaded DMG
rm $dmgname

# Clear out the used variables
unset dmgname
unset dmglink
unset dmgmountedname
unset apptoreplace
unset apptoreplacerunningname
unset netname
exit 0

Concluding Comments

The Dialpad desktop application allows you to make and receive phone calls via your computer.