Skip to content

Instantly share code, notes, and snippets.

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

Aleksandr Kamenev shurkin18

🏠
Working from home
View GitHub Profile
@shurkin18
shurkin18 / jssdistrorepair.sh
Last active March 2, 2022 21:15
JSS distribution point share folder permissions and accounts repair
#!/bin/bash
#################################################################################################################
# This script assumes, JSS is using default read and write usernames: jamf, jamfadmin
# This script also assumes that local administrator account used on the mac is named: administrator
#################################################################################################################
#Ask user to point to the share folder, browse to it via "cd"
FOLDER_TO_PROCESS=$(/usr/bin/osascript << EOD
tell application "System Events"
@shurkin18
shurkin18 / laps-prod.sh
Last active October 3, 2023 21:45
JAMF UAPI LAPS script for continuous local administrator password change, with password securely stored in JSS
#!/bin/bash
#################################################################################################################
# This script can be used together with "JAMF UAPI LAPS initialization script which will set LAPS Computer Extension Attribute to a desired password"
# URL of the other script: https://gist.github.com/shurkin18/50ae6e9da329a9332592df19e10744bb
#################################################################################################################
# Please note: this script requires jq JSON parser to be installed on the mac, otherwise the script won't work
# You can install jq JSON parser using brew by running this script, which will install brew and jq automatically (non-interactive):
# https://gist.github.com/shurkin18/62ec34967794a32f9d63615db881ab5c
#
@shurkin18
shurkin18 / laps-initialize.sh
Last active October 3, 2023 21:45
JAMF UAPI LAPS initialization script which will set LAPS Computer Extension Attribute to a desired password
#!/bin/bash
#################################################################################################################
# This script can be used together with: https://gist.github.com/shurkin18/b8de3de44b184f1f8802b860639a9b4d
#################################################################################################################
# Please note: this script requires jq JSON parser to be installed on the mac, otherwise the script won't work
# You can install jq JSON parser using brew by running this script, which will install brew and jq automatically (non-interactive):
# https://gist.github.com/shurkin18/62ec34967794a32f9d63615db881ab5c
#
# There is also an alternative way of running jq JSON parser, without installing the whole brew suite
@shurkin18
shurkin18 / setmacnameonJSS
Created September 10, 2021 18:07
JAMF UAPI script which will ask the user for computer name and update it on JSS and locally
#!/bin/bash
#################################################################################################################
# Update the following variables as needed: "apiUser", "apiPass", "apiURL"
#################################################################################################################
# server connection information
jssurl="API URL"
username="API USERNAME"
password="API PASSWORD"
@shurkin18
shurkin18 / druvainsyncactivationstatus.sh
Last active October 3, 2023 21:45
Checks if Druva inSync client is Active using UAPI and returns the status which can be used as JSS Computer Extension Attribute
#!/bin/bash
##########################################################################################################################################################################
##########################################################################################################################################################################
# Please note: this script requires jq JSON parser to be installed on the mac, otherwise the script won't work
# You can install jq JSON parser using brew by running this script, which will install brew and jq automatically (non-interactive):
# https://gist.github.com/shurkin18/62ec34967794a32f9d63615db881ab5c
#
# There is also an alternative way of running jq JSON parser, without installing the whole brew suite
# You can download the jq binary here: https://techstoreon.com/files/jq-osx-amd64
@shurkin18
shurkin18 / druvainsyncremoval.sh
Created October 8, 2021 02:41
Removes Druva inSync client completely including Keychain Access Manager entires, which prevent from re-activating it on the current mac
#!/bin/bash
set +x
user=`ls -l /dev/console | awk '//{print $3}'`
echo "loggedInUser:" $user
echo " Stopping inSync Client."
killall inSync
killall inSyncDecommission
@shurkin18
shurkin18 / installbrewthenloadjq.sh
Last active May 23, 2023 11:55
Installs brew via script, then installs/loads jq JSON parser
###########################################################################################
# There is also an alternative way of running jq JSON parser, without installing the whole brew suite
# You can download the jq binary here: https://techstoreon.com/files/jq-osx-amd64
# Pre-load it to each mac via the policy and store it somewhere (in /var for example) and just point your script to it
# every time jq needs to be used
###########################################################################################
#!/bin/bash
# Checks if jq is not already present, and if not - installs brew via script, then installs/loads jq JSON parser
#
@shurkin18
shurkin18 / mount-dmg-install-cleanup.sh
Last active August 26, 2022 15:42
Mounts the DMG, then runs/installs the installer inside it, then cleans up
#!/bin/bash
# Variables, dmgPath is where the DMG installer will be located and the packageName is the installer inside the DMG,
# usually it's someting like Install.pkg or Install.mpkg, you need to know what it is and supply it to "packageName" variable
# Update these variables based on the DMG/installer you will be using this script on
dmgPath="/Users/Shared/Application.dmg"
packageName="Install.pkg"
################################################################
@shurkin18
shurkin18 / JIRA-OnPrem-api-ticket-create.sh
Last active November 10, 2023 03:54
Search JIRA On-Prem for specific Issue and if none found - creates a new Issue via API
#!/bin/bash
# Please note: JIRA URL may be different for your setup, including all of the URL
# https://COMPANY-JIRA-URL.com/jira/rest/api/2/issue/ | you may need to play around with it to get it exact right
currentLoggedInUser=`stat -f '%u %Su' /dev/console | awk '{ print $2 }'`
echo "Currently logged in user is: $currentLoggedInUser"
#Create JIRA API ticket
curl \
@shurkin18
shurkin18 / JIRA-Cloud-api-ticket-create.sh
Last active July 6, 2023 21:32
Search JIRA Cloud for specific Issue and if none found - creates a new Issue via API
#!/bin/bash
####################################################################################################################################
# NOTE: you will need to generate a token (https://id.atlassian.com/manage-profile/security/api-tokens and click "Create API token")
# Make sure that account has necessary access (JIRA groups) on the JIRA's end, especially if you will be creating tickets via API
# In this example, we will search JIRA for issues with a specific title and specific reporter
# and if nothing found the script will create a new issue/ticket under Project "IT" and a specific Issue Type ID we set, assigned (Reporter) to currently logged in user (NOTE: this is for mac only), with specific Issue title and description
####################################################################################################################################
####################################################################################################################################