项目作者: SKeenan07

项目描述 :
高级语言: Shell
项目地址: git://github.com/SKeenan07/mac-admin-scripts.git
创建时间: 2021-01-13T22:01:07Z
项目社区:https://github.com/SKeenan07/mac-admin-scripts

开源协议:

下载


Mac Admin Scripts

Adobe

Click the header above for more info about my Adobe scripts.

Auto Logout

Click the header above for more info about my auto-logout script.

Install Latest

The scripts in this folder install the latest version of the app if it is not already installed.

Setup with DEPNotify

Click the header above for more info about my DEPNotify setup scripts.


changeOwnerToCurrentUser.sh

This script changes the owner of the files specified in the input parameters to the current user. If the path to the file is in the User’s directory, use ~/ (i.e., ~/folder/file.txt)

deleteInactiveUsers.zsh

This script deletes users that have not logged in within the last specified number of days. This script uses multiple input parameters for configuring the script.

Parameters:

  1. Mode (DEBUG | TESTING) - DEBUG will display additional output - TESTING mode will not delete any accounts (You can use both of these at the same time, just separate them with a space.)
  2. Number of days of inactivity (e.g. 10 → the account will be deleted when it has been inactive for 10 or more days.)
  3. Users to not delete (separate usernames with a space)
  4. (I’m using this parameter internally to differentiate between different types of accounts. I did not include this parameter in the script.)
  5. Admin Username
  6. Admin password - encrypted string
  7. Admin password - salt
  8. Admin password - passphrase

Error Codes

  • 51 = Parameter 5 can only contain digits
  • 52 = No value set for Parameter 5
  • 80 = No value(s) for Admin Username/Password

deleteItems.zsh

This script deletes items specified in the input parameters.

Parameters:

  1. Delimiter (The character that separates the items to delete, such as a comma.)
  2. Folder to delete items from (The folder path must begin and end with a /.)
  3. Items to delete
  4. Folder depth to search - If 1, it will only look inside the root folder. If 2, it will look inside the root folder and its subfolders.

Error Codes

  • 40 = No delimiter specified
  • 50 = No folder specified
  • 51 = Specified folder does not exist
  • 52 = Specified folder does not match regex
  • 60 = No items specified
  • 71 = Specified value does not match regex

eraseAndInstallMacOS.zsh

This script erases and reinstalls the macOS specified in the input parameters.

Parameters:

  1. Name of macOS installer (e.g. Install macOS Big Sur.app)
  2. Custom trigger of policy that installs the installer

Error Codes

  • 1 = Failed to install install app
  • 40 = Install app not specified
  • 41 = Install app does not match format
  • 51 = Custom trigger not specified

excelToPlist.applescript

This script creates an empty plist and gets the used range of an Excel spreadsheet. Then, for every row of the used range, a string key is created with the key set to item 2 and the value set to item 1.

getExtensionAttributeChoices.zsh

This script gets the choices of a popup computer extension attribute using the Jamf Classic API. The API user will need to have read access to computer extension attributes.

macOSisN-2.zsh

This script gets the installed macOS version and the current macOS version from Jamf’s macOS patch definition. If the installed macOS version matches a regex of the three most recent macOS versions, then the script returns true. If not, the script returns false.

makeCurrentUserAdmin.sh

This script gets the current user and checks to see if they’re an admin. If the current user is not in the admin group, then they are added to the group.

runInstallAppFromDMG.sh

This script uses input parameters to run an install application that is inside a DMG.

Parameters:

  1. DMG Name
  2. Volume Name
  3. Install Application Name
  4. Install Options / Flags

Error Codes

  • 40 = No DMG specified
  • 41 = Specified DMG does not exist
  • 42 = Unknown problem with DMG variable
  • 50 = No Volume Name specified
  • 51 = Volume does not exist
  • 60 = No Install Application specified
  • 61 = Specified Install Application does not exist
  • 62 = Unknown problem with Install Application

uninstallMicrosoftOffice.zsh

This script follows the instructions from the following Microsoft Support article: Uninstall Office for Mac. It removes the following:

  • /Applications/Microsoft Excel.app
  • /Applications/Microsoft OneNote.app
  • /Applications/Microsoft Outlook.app
  • /Applications/Microsoft PowerPoint.app
  • /Applications/Microsoft Teams.app
  • /Applications/Microsoft Word.app
  • /Applications/OneDrive.app
  • ~/Library/Containers/com.microsoft.errorreporting
  • ~/Library/Containers/com.microsoft.Excel
  • ~/Library/Containers/com.microsoft.netlib.shipassertprocess
  • ~/Library/Containers/com.microsoft.Office365ServiceV2
  • ~/Library/Containers/com.microsoft.Outlook
  • ~/Library/Containers/com.microsoft.Powerpoint
  • ~/Library/Containers/com.microsoft.RMS-XPCService
  • ~/Library/Containers/com.microsoft.Word
  • ~/Library/Containers/com.microsoft.onenote.mac
  • ~/Library/Group Containers/UBF8T346G9.ms
  • ~/Library/Group Containers/UBF8T346G9.Office
  • ~/Library/Group Containers/UBF8T346G9.OfficeOsfWebHost
  • ~/Library/Caches/com.microsoft.teams
  • ~/Library/Caches/com.microsoft.teams.shipit
  • ~/Library/Application Support/Microsoft/Teams

uninstallPrinter.zsh

This script uninstalls printers specified in the input parameters.