Skip to content

Instantly share code, notes, and snippets.

View matthewbodaly's full-sized avatar

Matthew matthewbodaly

View GitHub Profile
@matthewbodaly
matthewbodaly / FindInstalledProfiles.md
Last active August 2, 2022 14:17
Need to find if a profile is installed on a computer? Here's how I did it.

I was having problems deploying a profile to a set of computers. I've observed that occasionally MDM needs to be reset on a computer (thanks Apple / JAMF). About 50% of computers in this set were still showing as "pending" for a specific profile. This is after confirming the computers in the office and I've spammed "send blank push" and have cancelled all pending / failed commands. These computers were still regularly checking in, so that part worked.

Part 1. - Test and Detect -- Deploy SadMDM (or sadderMDM) manually via Self Service to a few affected computers to verify that this works on the network. You can see the commands for SadMDM (there's got to be a better name for this) here: (https://gist.github.com/matthewbodaly/818be381744261a432b4794a410b8bc9) -- Add the EA below to the JSS. This will show all installed profiles as an Extension attribute. -- Make a smart group that has "Is Not Like" the UUID of the profile you are searching for. You could do another thing, but ... UUID is harder to masquerade a

About a week ago my Internet dropped right before we were going to go on vacation. This is how I got probably the worst possible bandaid to fix it.

background

I live in a building thats been around since the '60s. I have a cable Internet connection where the wire is older than my kids ages combined. Usually every few weeks, the Internet will have a few minutes of complete packet drops and then recover. This time, it was down for over 15 minutes. This happened right before we were about to leave on vacation so I did the bare minimum of "turning it on again" and reseating connections. No dice. This would have to wait until after I was back from the trip.

post vacation

After getting back from vacation, I contacted our ISP who walked me through... resetting the connection and ... reseating wires, still didn't work so a tech was scheduled. In the meantime, the kids kept asking for the Internet to be setup so I fired up the hotspot we used on trips. This works fine, but I really didn't want to reconfigure e

@matthewbodaly
matthewbodaly / Generated Random Number.xml
Last active October 7, 2021 08:52
Testingwithrandomnumbrers.md
<?xml version="1.0" encoding="UTF-8"?><extensionAttribute>
<displayName>Generated Random Number</displayName>
<description>This will view the generated random number</description>
<dataType>string</dataType>
<scriptContentsMac>#!/bin/bash&#13;
# Generate a random number. This is used best when you want break up computers into groups for testing.&#13;
# Use with a reporting app to read the number and sort your computers&#13;
# For an example of that, refer to:&#13;
# https://gist.github.com/matthewbodaly/7a6cfabb74d896ca609bca9f62226463&#13;
#&#13;
@matthewbodaly
matthewbodaly / randomnumberEA.sh
Last active October 1, 2020 01:00
Create an EA with Jamf to detect a random number
#!/bin/sh
result=`head -n 1 "/Library/Application Support/dt/digit.txt"`
echo "<result>$result</result>"
@matthewbodaly
matthewbodaly / swapfvkey.sh
Created August 11, 2016 17:57
swaps keys.
#!/bin/bash
####################################################################################################
#
# Copyright (c) 2013, JAMF Software, LLC. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
#!/bin/bash
# For a good time, run Time Machine over VPN.
# yourfuneral
# snapshot
tmutil snapshot
# disable Time Machine
tmutil disable
exit 0
#!/bin/sh
#enable logging
defaults write /Library/Preferences/com.apple.MCXDebug debugOutput -2
defaults write /Library/Preferences/com.apple.MCXDebug collateLogs 1
touch /var/db/MDM_EnableDebug
#reset DEP
rm /var/db/.AppleSetupDone
rm -rf /var/db/ConfigurationProfiles/
rm /Library/Keychains/apsd.keychain
# Remove JAMF Framework
@matthewbodaly
matthewbodaly / renamecomputer.sh
Last active June 6, 2019 20:36
Rename a computer
#!/bin/bash
# copied from https://jamfnation.jamfsoftware.com/discussion.html?id=16743
# v 1.1 cleaned up old way of doing things
name=$(osascript -e 'Tell application "System Events" to display dialog "Please enter a name for your computer or select Cancel." default answer ""' -e 'text returned of result' 2>/dev/null)
if [ $? -ne 0 ]
then # user cancel
exit
elif [ -z "$name" ]
then # loop until input or cancel
@matthewbodaly
matthewbodaly / emailtosam.ps1
Created March 15, 2019 04:28
Thanks StackOverflow
# your funeral
# This isn't original to me
# https://stackoverflow.com/questions/47035953/how-to-get-samaccountname-from-an-e-mail-using-powershell
Get-Content ".\in.txt" |
ForEach-Object { Get-ADUser -LDAPFilter "(mail=$_)" } |
Select-Object -ExpandProperty sAMAccountName |
Out-File ".\out.txt"

Keybase proof

I hereby claim:

  • I am matthewbodaly on github.
  • I am thejedi (https://keybase.io/thejedi) on keybase.
  • I have a public key whose fingerprint is 8980 4264 E5F3 3189 42DC 2548 98BD 3B2D DEA5 1D97

To claim this, I am signing this object: