Skip to content

Instantly share code, notes, and snippets.

@talkingmoose
talkingmoose / Match Version Number or Higher.bash
Last active April 24, 2024 03:46
Generates a regular expression (regex) that matches the provided version number or higher. Useful for Jamf Pro's "matches regex" operator in searches and smart groups where the results need to be the current version of an app or higher.
#!/bin/bash
<<ABOUT_THIS_SCRIPT
-------------------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
bill@talkingmoose.net
https://gist.github.com/2cf20236e665fcd7ec41311d50c89c0e
@talkingmoose
talkingmoose / Download and Install Microsoft product.zsh
Last active April 22, 2024 23:51
**Download the latest version of this script from: https://gist.github.com/b6637160b65b751824943ede022daa17 .** Downloads and installs the latest available Microsoft product specified directly on the client. This avoids having to manually download and store an up-to-date installer on a distribution server every month.
#!/bin/zsh
:<<'ABOUT_THIS_SCRIPT'
-----------------------------------------------------------------------
Written by:William Smith
Partner Program Manager
Jamf
bill@talkingmoose.net
https://gist.github.com/b6637160b65b751824943ede022daa17
@talkingmoose
talkingmoose / Download and Install Microsoft product.zsh
Last active April 22, 2024 23:32
Downloads and installs the latest available Microsoft product specified directly on the client. This avoids having to manually download and store an up-to-date installer on a distribution server every month.
#!/bin/zsh
:<<'ABOUT_THIS_SCRIPT'
-----------------------------------------------------------------------
Written by:William Smith
Partner Program Manager
Jamf
bill@talkingmoose.net
https://gist.github.com/b6637160b65b751824943ede022daa17
@talkingmoose
talkingmoose / Report admin status.bash
Created August 26, 2020 22:29
Report if any macOS user accounts with admin privileges exist.
#!/bin/bash
# list all users with UIDs above 501
usersList=$( /usr/bin/dscl . -list /Users uid | /usr/bin/awk '$2 >= 501 { print $1 }' )
# test for admin
while IFS= read aUser
do
/usr/sbin/dseditgroup -o checkmember -u "$aUser" admin 1>/dev/null
#!/bin/zsh
:<<ABOUT_THIS_SCRIPT
-----------------------------------------------------------------------
Written by:William Smith
Partner Program Manager
Jamf
bill@talkingmoose.net
https://gist.github.com/talkingmoose/15f055885b51cc8cb0bc7aad021acead
@talkingmoose
talkingmoose / Retrieve LAPS Password.zsh
Last active April 15, 2024 19:38
Retrieves the Jamf Pro LAPS password for the current computer. The script assumes a desktop administrator is operating the computer. The administrator will open Self Service, authenticate, and run the policy with the script.
#!/bin/zsh
# set -x
:<<ABOUT_THIS_SCRIPT
-----------------------------------------------------------------------
Written by:William Smith
Partner Program Manager
Jamf
bill@talkingmoose.net
@talkingmoose
talkingmoose / Location Information.zsh
Created April 9, 2024 16:50
Add the following script to a Jamf Pro extension attribute to collect service provider location information based on public IP address when updating inventory.
#!/bin/zsh
# get public IP address
publicIP=$( /usr/bin/curl http://ifconfig.me/ip \
--location \
--silent \
--max-time 10 )
# get GeoIP data
locationData=$( /usr/bin/curl http://ip-api.com/xml/$publicIP \
@talkingmoose
talkingmoose / queryOutlookFreeBusy.scpt
Last active April 5, 2024 22:09
AppleScript to look up an Exchange user's free/busy time using Outlook for Mac
tell application "Microsoft Outlook"
query freebusy exchange account 1 for attendees {"bill@talkingmoose.net"} range start time date "Thursday, September 8, 2016 at 12:00:00 AM" range end time date "Friday, September 9, 2016 at 12:00:00 AM" interval 60
end tell
@talkingmoose
talkingmoose / Download and install Google Chrome.zsh
Last active April 3, 2024 12:10
Checks version of latest avaialble version of Google Chrome online and compares with locally installed version. Downloads and installs if installed version is older or doesn't exist.
#!/bin/zsh
:<<ABOUT_THIS_SCRIPT
-------------------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
bill@talkingmoose.net
https://gist.github.com/cc4b1d143bcdf7d6d670ab1b30565694
@talkingmoose
talkingmoose / Create User Account.zsh
Last active April 3, 2024 10:01
Simple script to create a new macOS user account. Will not provide a SecureToken.
#!/bin/zsh
# new user account details
username="lapsadmin"
displayName="LAPS Admin"
password="P@55w0rd"
admin="yes"
hidden="yes"
# determine next available UID