Skip to content

Instantly share code, notes, and snippets.

View kdrwygvh's full-sized avatar
🏠
Working from home

John Hutchison kdrwygvh

🏠
Working from home
View GitHub Profile
#!/usr/bin/env bash
echo "Enter an API User with Create Category Permissions:"
read apiUser
echo "Enter the Password for this API User:"
read -s apiPassword
@kdrwygvh
kdrwygvh / User Log in Date.sh
Last active January 7, 2020 15:46
User Log in Date
#!/bin/sh
currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
echo "<result>$(w -h "$currentUser" | head -1 | awk '{print $4}')</result>"
@kdrwygvh
kdrwygvh / User Idle Time.sh
Last active January 7, 2020 15:46
User Idle Time
#!/bin/sh
currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
echo "<result>$(w -h "$currentUser" | head -1 | awk '{print $5}')</result>"
@kdrwygvh
kdrwygvh / Storage Medium.sh
Created January 8, 2020 13:59
Storage Medium
#!/bin/sh
echo "<result>$(system_profiler SPStorageDataType | awk '/Medium Type/ {print $3}' | head -1)</result>"
@kdrwygvh
kdrwygvh / Enable Apple Remote Desktop and Privileges.sh
Created January 8, 2020 14:43
Enable Apple Remote Desktop and Configure Privileges
#!/bin/sh
####################################################################################################
#
# Copyright (c) 2010, 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
#!/usr/bin/env zsh
### Collecting current user attributes ###
currentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{print $3}')
currentUserUID=$(/usr/bin/id -u "$currentUser")
currentUserHomeDirectoryPath="$(dscl . -read /Users/$currentUser NFSHomeDirectory | awk -F ': ' '{print $2}')"
##########################################################################################
if [[ "$currentUser" = "root" ]]; then
echo "No user is logged in, wait until later to perform Box preinstall/postinstall
#!/usr/bin/env zsh
### Collecting current user attributes ###
currentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{print $3}')
currentUserUID=$(/usr/bin/id -u "$currentUser")
currentUserHomeDirectoryPath="$(dscl . -read /Users/$currentUser NFSHomeDirectory | awk -F ': ' '{print $2}')"
##########################################################################################
##Box Edit PostInstall
sudo -u "$currentUser" mkdir -p "$currentUserHomeDirectoryPath/Library/Application Support/Box/Box Edit/PKG Installer log/"
@kdrwygvh
kdrwygvh / Randomize Clinical Trial Number.xml
Last active August 8, 2020 15:21
Jamf Pro Extension Attribute to generate random numbers for managed Macs. Macs can be grouped based on their random number range to achieve some random spread in the distribution of a given Jamf Pro object
<?xml version="1.0" encoding="UTF-8"?><extensionAttribute>
<displayName>Randomized Clinical Trial Number</displayName>
<description/>
<dataType>number</dataType>
<scriptContentsMac>#!/usr/bin/env zsh&#13;
&#13;
preferenceDomain=""&#13;
if [[ "$preferenceDomain" = "" ]]; then&#13;
preferenceDomain="com.github"&#13;
fi&#13;
@kdrwygvh
kdrwygvh / SIPProtectedPaths.txt
Created January 6, 2021 14:00
SIP Protected Paths in macOS 11+
/Applications/Safari.app
/Library/Apple
/Library/Application Support/com.apple.TCC
/Library/CoreAnalytics
/Library/Filesystems/NetFSPlugins/Staged
/Library/Filesystems/NetFSPlugins/Valid
/Library/Frameworks/iTunesLibrary.framework
/Library/GPUBundles
/Library/KernelCollections
/Library/MessageTracer
#!/usr/bin/env zsh
# https://social.technet.microsoft.com/wiki/contents/articles/7608.srv-records-registered-by-net-logon.aspx
# https://docs.microsoft.com/en-us/troubleshoot/windows-server/networking/verify-srv-dns-records-have-been-created
declare -a activeDirectoryDomainNameTests=(
_ldap._tcp."$1".
_ldap._tcp.dc._msdcs."$1"
_ldap._tcp.pdc._msdcs."$1".
_kerberos._tcp. "$1" .