├── .gitignore ├── README.md ├── Policy Scripts ├── jamf_mdm_bounce.sh ├── osUpdatesViaAppStore.sh ├── demoteAdminUser.sh ├── promoteAdminUser.sh ├── trashMe.sh ├── addArdUsersByPolicy.sh ├── sshUsersByPolicy.sh ├── mdmReboot.sh ├── jamfHelperByPolicy.sh ├── logUserOut.sh ├── installAllCertsInPath.sh ├── aameeSerializingScript.sh ├── openAppAsRoot.sh ├── dnsFlush.sh ├── fvStatusJamfHelper.sh └── gateKeeperTrustAppList.sh ├── Extension Attributes ├── ea_sshUsers.sh ├── ea_hostnameTestAdLocal.sh └── ea_listLocalAdmins.sh ├── Casper Imaging Scripts └── wipedisk.sh ├── API Scripts ├── changeBuildingJssApi.sh ├── changeSiteJssApi.sh ├── changeExtensionAttributeJssApi.sh ├── jssApiObjectReport.sh └── massUpdateComputerEaValues.sh ├── Manual Scripts ├── moveUserHome.sh └── osxMinimalDiskShrinker.sh ├── Enrollment Scripts └── ard_checkAndEnroll.sh └── Reporting Scripts ├── objects_scoped_to_AllComputers.sh ├── objects_scoped_to_named_computer_group.sh └── object_utilization_by_group.sh /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Casper-Scripts 2 | I spend most of my time at JAMF in front of customers, and often come up with similar solutions to similar tasks. 3 | Here is a single spot to share some of my favorite Casper Suite solutions. Enjoy! 4 | -------------------------------------------------------------------------------- /Policy Scripts/jamf_mdm_bounce.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #################################################################################################### 3 | # 4 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 5 | # 6 | # This script was written by the JAMF Software Profesional Services Team 7 | # 8 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 9 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 10 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 11 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 12 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 13 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 14 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 15 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 16 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 17 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 18 | # 19 | ##################################################################################################### 20 | # 21 | # SUPPORT FOR THIS PROGRAM 22 | # 23 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 24 | # information or support for this script, please contact your JAMF Software Account Manager. 25 | # 26 | ##################################################################################################### 27 | # 28 | # ABOUT THIS PROGRAM 29 | # 30 | # NAME 31 | # jamf_mdm_bounce.sh 32 | # 33 | # SYNOPSIS - How to use 34 | # Run via a policy to remove MDM and any other profiles on a Mac, then re-enroll in MDM. 35 | # 36 | # 37 | #################################################################################################### 38 | # 39 | # HISTORY 40 | # 41 | # Version: 1.0 42 | # 43 | # - Created by Douglas Worley, Professional Services Engineer, JAMF Software on May 10, 2013 44 | # 45 | #################################################################################################### 46 | # Tell the jamf binary to dump MDM 47 | jamf removemdmprofile 48 | 49 | # Manually scrub any additional configuration profiles 50 | echo yes | profiles -D 51 | 52 | # Tell the jamf binary to re-enroll in MDM 53 | jamf manage 54 | -------------------------------------------------------------------------------- /Policy Scripts/osUpdatesViaAppStore.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | #################################################################################################### 4 | # 5 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 6 | # 7 | # This script was written by the JAMF Software Profesional Services Team 8 | # 9 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 10 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 11 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 12 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 13 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 14 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 15 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 16 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 17 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 18 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19 | # 20 | ##################################################################################################### 21 | # 22 | # SUPPORT FOR THIS PROGRAM 23 | # 24 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 25 | # information or support for this script, please contact your JAMF Software Account Manager. 26 | # 27 | ##################################################################################################### 28 | # 29 | # ABOUT THIS PROGRAM 30 | # 31 | # NAME 32 | # osUpdatesViaAppStore.sh 33 | # 34 | # SYNOPSIS - How to use 35 | # 36 | # Distribute via policy to prompt users to use App Store to update software. 37 | # Scope to a Smart Group for computers who have >1 available update. 38 | # 39 | #################################################################################################### 40 | # 41 | # HISTORY 42 | # 43 | # Version: 1.0 44 | # 45 | # - Created by Douglas Worley, Professional Services Engineer, JAMF Software on August 27 2015 46 | # 47 | #################################################################################################### 48 | 49 | /usr/bin/osascript <`readTheGroups $theGroups`" 68 | -------------------------------------------------------------------------------- /Policy Scripts/demoteAdminUser.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # clear 3 | # 4 | #################################################################################################### 5 | # 6 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 7 | # 8 | # This script was written by the JAMF Software Profesional Services Team 9 | # 10 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 11 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 12 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 13 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 14 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 15 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 16 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 17 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 18 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 19 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 20 | # 21 | ##################################################################################################### 22 | # 23 | # SUPPORT FOR THIS PROGRAM 24 | # 25 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 26 | # information or support for this script, please contact your JAMF Software Account Manager. 27 | # 28 | ##################################################################################################### 29 | # 30 | # ABOUT THIS PROGRAM 31 | # 32 | # NAME 33 | # demoteAdminUser.sh 34 | # 35 | # SYNOPSIS - How to use 36 | # 37 | # 1) View an enrolled Mac in the JSS and get a report of all local admins on the system. 38 | # 2) Run this script in Casper Remote to demote a specific user out of the admin group. 39 | # 3) Repeat for any additional users. Each account must be demoted one by one. 40 | # 41 | # 42 | #################################################################################################### 43 | # 44 | # HISTORY 45 | # 46 | # Version: 1.0 47 | # 48 | # - Created by Douglas Worley, Senior Professional Services Engineer, JAMF Software on April 14 2016 49 | # 50 | #################################################################################################### 51 | 52 | userNameToDemote="" 53 | if [[ "$4" != "" ]] && [[ "$userNameToDemote" == "" ]]; then 54 | userNameToDemote=$4 55 | fi 56 | 57 | 58 | dseditgroup -o edit -d "${userNameToDemote}" -t user admin 59 | if [ "$?" == "0" ]; then #error checking 60 | echo "Successfully removed $userNameToDemote from admin group" 61 | else 62 | echo "ALERT - There was a problem with removing $userNameToDemote from admin group..." 63 | fi -------------------------------------------------------------------------------- /Policy Scripts/promoteAdminUser.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # clear 3 | # 4 | #################################################################################################### 5 | # 6 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 7 | # 8 | # This script was written by the JAMF Software Profesional Services Team 9 | # 10 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 11 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 12 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 13 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 14 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 15 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 16 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 17 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 18 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 19 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 20 | # 21 | ##################################################################################################### 22 | # 23 | # SUPPORT FOR THIS PROGRAM 24 | # 25 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 26 | # information or support for this script, please contact your JAMF Software Account Manager. 27 | # 28 | ##################################################################################################### 29 | # 30 | # ABOUT THIS PROGRAM 31 | # 32 | # NAME 33 | # promoteAdminUser.sh 34 | # 35 | # SYNOPSIS - How to use 36 | # 37 | # 1) View an enrolled Mac in the JSS and get a report of all local accounts on the system. 38 | # 2) Run this script in Casper Remote to promote a specific user into the admin group. 39 | # 3) Repeat for any additional users. Each account must be promoted one by one. 40 | # 41 | # 42 | #################################################################################################### 43 | # 44 | # HISTORY 45 | # 46 | # Version: 1.0 47 | # 48 | # - Created by Douglas Worley, Senior Professional Services Engineer, JAMF Software on April 14 2016 49 | # 50 | #################################################################################################### 51 | 52 | userNameToPromote="" 53 | if [[ "$4" != "" ]] && [[ "$userNameToPromote" == "" ]]; then 54 | userNameToPromote=$4 55 | fi 56 | 57 | 58 | dseditgroup -o edit -a "${userNameToPromote}" -t user admin 59 | if [ "$?" == "0" ]; then #error checking 60 | echo "Successfully added $userNameToPromote to admin group" 61 | else 62 | echo "ALERT - There was a problem with adding $userNameToPromote to admin group..." 63 | fi -------------------------------------------------------------------------------- /Policy Scripts/trashMe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | #################################################################################################### 4 | # 5 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 6 | # 7 | # This script was written by the JAMF Software Profesional Services Team 8 | # 9 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 10 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 11 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 12 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 13 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 14 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 15 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 16 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 17 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 18 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19 | # 20 | ##################################################################################################### 21 | # 22 | # SUPPORT FOR THIS PROGRAM 23 | # 24 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 25 | # information or support for this script, please contact your JAMF Software Account Manager. 26 | # 27 | ##################################################################################################### 28 | # 29 | # ABOUT THIS PROGRAM 30 | # 31 | # NAME 32 | # trashMe.com 33 | # 34 | # SYNOPSIS - How to use 35 | # 36 | # Pass in the path of a file or folder to be moved into the current logged in user's Trash. 37 | # This script does not empty the trash, the current logged in user must do that separately. 38 | # 39 | #################################################################################################### 40 | # 41 | # HISTORY 42 | # 43 | # Version: 1.0 44 | # 45 | # - Created by Douglas Worley, Professional Services Engineer, JAMF Software on August 27 2015 46 | # 47 | #################################################################################################### 48 | 49 | clear 50 | 51 | theRubbish="" 52 | [[ "$4" != "" ]] && [[ "$theRubbish" == "" ]] && "$theRubbish"="$4" 53 | 54 | CurrentUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'` 55 | userTrash="/Users/$CurrentUser/.Trash" 56 | echo "Current user trashcan is $userTrash" 57 | 58 | function trashTheRubbish () { 59 | thePieceOfRubbish=`basename "$theRubbish"` 60 | echo "Moving $thePieceOfRubbish to $userTrash" 61 | mv "$theRubbish" "$userTrash/$thePieceOfRubbish" 62 | } 63 | 64 | [[ -e "$theRubbish" ]] && trashTheRubbish || echo "File $theRubbish not found" 65 | -------------------------------------------------------------------------------- /Casper Imaging Scripts/wipedisk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #################################################################################################### 4 | # 5 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 6 | # 7 | # This script was written by the JAMF Software Profesional Services Team 8 | # 9 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 10 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 11 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 12 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 13 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 14 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 15 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 16 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 17 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 18 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19 | # 20 | ##################################################################################################### 21 | # 22 | # SUPPORT FOR THIS PROGRAM 23 | # 24 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 25 | # information or support for this script, please contact your JAMF Software Account Manager. 26 | # 27 | ##################################################################################################### 28 | # 29 | # ABOUT THIS PROGRAM 30 | # 31 | # NAME 32 | # wipedisk.sh 33 | # 34 | # SYNOPSIS - How to use 35 | # 36 | # Run this script as part of a JAMF Imaging Config 37 | # 38 | # DESCRIPTION 39 | # 40 | # This script wipes the first internal hard disk (disk0) in such a way to destroy all 41 | # FileVault and Boot Camp data, allowing Casper Imaging to then prep for a full deployment. 42 | # 43 | # 44 | # USAGE 45 | # 46 | # Set the priority to "before", as well as choose the checkbox for "Erase target drive" 47 | # when running Casper Imaging 48 | # 49 | # WARNING 50 | # 51 | # Before running this script, double check what the /dev/disk* path will be. 52 | # Example - The internal hard drive shows up differently if NetBooted versus over Target Mode Imaging. 53 | # 54 | #################################################################################################### 55 | # 56 | # HISTORY 57 | # 58 | # Version: 1.0 59 | # - Created by Douglas Worley, Professional Services Engineer, JAMF Software on August 21, 2014 60 | # 61 | #################################################################################################### 62 | 63 | 64 | diskutil zerodisk /dev/disk0 & 65 | sleep 20 66 | killall diskutil 67 | sleep 5 68 | diskutil partitionDisk /dev/disk0 1 GPTFormat JournaledHFS+ "Macintosh HD" 100% 69 | sleep 5 -------------------------------------------------------------------------------- /Extension Attributes/ea_hostnameTestAdLocal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | #################################################################################################### 4 | # 5 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 6 | # 7 | # This script was written by the JAMF Software Profesional Services Team for the 8 | # JumpStart 9 | # 10 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 11 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 12 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 13 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 14 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 15 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 16 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 17 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 18 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 19 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 20 | # 21 | ##################################################################################################### 22 | # 23 | # SUPPORT FOR THIS PROGRAM 24 | # 25 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 26 | # information or support for this script, please contact your JAMF Software Account Manager. 27 | # 28 | ##################################################################################################### 29 | # 30 | # ABOUT THIS PROGRAM 31 | # 32 | # NAME 33 | # ea_hostnameTestAdLocal.sh 34 | # 35 | # SYNOPSIS - How to use 36 | # 37 | # Extension attribute to validate that the local hostname of a Mac is the same as what it is bound to AD with. 38 | # You can make a smart group where the contents are like "Mismatch" to find all computers needing attention. 39 | # 40 | # 41 | # 42 | # 43 | # 44 | #################################################################################################### 45 | # 46 | # HISTORY 47 | # 48 | # Version: 1.0 49 | # 50 | # - Created by Douglas Worley, Senior Professional Services Engineer, JAMF Software on April 7 2016 51 | # 52 | #################################################################################################### 53 | clear 54 | 55 | boundAdName=`dsconfigad -show | awk '/Computer Account/ { print $4 }'` 56 | echo " This Mac's bound name in AD is: ${boundAdName%?}" 57 | 58 | localHostname=`hostname -s` 59 | echo " This Mac's local hostname is: $localHostname" 60 | 61 | if [[ ${boundAdName%?} == $localHostname ]]; then 62 | echo " The names match, all is fine" 63 | echo "Match - $localHostname" 64 | else 65 | echo " ALERT Then names do not match, please remediate " 66 | echo "Mismatch - AD: ${boundAdName%?} / Local: $localHostname" 67 | fi 68 | exit $? -------------------------------------------------------------------------------- /Policy Scripts/addArdUsersByPolicy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | #################################################################################################### 4 | # 5 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 6 | # 7 | # This script was written by the JAMF Software Profesional Services Team 8 | # 9 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 10 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 11 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 12 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 13 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 14 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 15 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 16 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 17 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 18 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19 | # 20 | ##################################################################################################### 21 | # 22 | # SUPPORT FOR THIS PROGRAM 23 | # 24 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 25 | # information or support for this script, please contact your JAMF Software Account Manager. 26 | # 27 | ##################################################################################################### 28 | # 29 | # ABOUT THIS PROGRAM 30 | # 31 | # NAME 32 | # addArdUsersByPolicy.sh 33 | # 34 | #################################################################################################### 35 | # 36 | # HISTORY 37 | # 38 | # Version: 1.0 39 | # 40 | # - Created by Douglas Worley, Senior Professional Services Engineer, JAMF Software on March 26 2016 41 | # 42 | #################################################################################################### 43 | 44 | # HARDCODED VALUE FOR "USERNAME" IS SET HERE 45 | users="" 46 | 47 | # CHECK TO SEE IF A VALUE WAS PASSED IN PARAMETER 4 AND, IF SO, ASSIGN TO "USERNAME" 48 | # Multiple users can be specified in a single string, separated by a comma. Example: "user1,user2" 49 | # You should include the JAMF Management account here at very least for Casper Remote to work properly. 50 | 51 | if [ "$4" != "" ] && [ "$users" == "" ];then 52 | users=$4 53 | fi 54 | 55 | 56 | 57 | 58 | if [ "$users" != "" ]; then 59 | echo "Enabling Apple Remote Desktop Agent..." 60 | /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -allowAccessFor -specifiedUsers 61 | echo "Setting Remote Management Privileges for User: $users ..." 62 | /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -access -on -privs -all -users $users 63 | else 64 | echo "Error: The parameter 'users' is blank. Please specify a user." 65 | fi 66 | 67 | -------------------------------------------------------------------------------- /Policy Scripts/sshUsersByPolicy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #################################################################################################### 4 | # 5 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 6 | # 7 | # This script was written by the JAMF Software Profesional Services Team 8 | # 9 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 10 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 11 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 12 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 13 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 14 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 15 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 16 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 17 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 18 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19 | # 20 | ##################################################################################################### 21 | # 22 | # SUPPORT FOR THIS PROGRAM 23 | # 24 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 25 | # information or support for this script, please contact your JAMF Software Account Manager. 26 | # 27 | ##################################################################################################### 28 | # 29 | # ABOUT THIS PROGRAM 30 | # 31 | # NAME 32 | # sshAccess.sh 33 | # 34 | # SYNOPSIS - How to use 35 | # 36 | # Run this script locally in a shell with sudo privileges or with a JAMF Policy 37 | # 38 | # DESCRIPTION 39 | # 40 | # This script looks for parameters or locally saved variables to define user/group accounts to include 41 | # into the ssh access list. 42 | # 43 | # 44 | # USAGE 45 | # 46 | # Run this script manually in a shell or via a Casper Policy. 47 | # Parameters can pass in sshUser and sshGroup values in policies. 48 | # 49 | #################################################################################################### 50 | # 51 | # HISTORY 52 | # 53 | # Version: 1.0 54 | # - Created by Douglas Worley, Professional Services Engineer, JAMF Software on August 21, 2014 55 | # 56 | #################################################################################################### 57 | 58 | # Global variables 59 | sshUser="" 60 | sshGroup="" 61 | 62 | # check for parameters to use later 63 | if [ "$4" != "" ] && [ "$sshUser" == "" ]; then 64 | sshUser=$4 65 | fi 66 | if [ "$5" != "" ] && [ "$sshGroup" == "" ]; then 67 | sshGroup=$5 68 | fi 69 | 70 | # Add the required minimum users and group to the ssh access group in Directory Services. These are hard coded by use of the "hardCodedUser" and "hardCodedGroup" values 71 | # dseditgroup -o edit -n /Local/Default -a "hardCodedUser" -t user com.apple.access_ssh 72 | # dseditgroup -o edit -n /Local/Default -a "hardCodedGroup" -t group com.apple.access_ssh 73 | 74 | # Pass in additional users and groups via populated parameters from a policy 75 | dseditgroup -o edit -n /Local/Default -a "$sshUser" -t user com.apple.access_ssh 76 | dseditgroup -o edit -n /Local/Default -a "$sshGroup" -t group com.apple.access_ssh 77 | -------------------------------------------------------------------------------- /Extension Attributes/ea_listLocalAdmins.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | #################################################################################################### 4 | # 5 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 6 | # 7 | # This script was written by the JAMF Software Profesional Services Team 8 | # 9 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 10 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 11 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 12 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 13 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 14 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 15 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 16 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 17 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 18 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19 | # 20 | ##################################################################################################### 21 | # 22 | # SUPPORT FOR THIS PROGRAM 23 | # 24 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 25 | # information or support for this script, please contact your JAMF Software Account Manager. 26 | # 27 | ##################################################################################################### 28 | # 29 | # ABOUT THIS PROGRAM 30 | # 31 | # NAME 32 | # eaListLocalUsers.sh 33 | # 34 | # SYNOPSIS - How to use 35 | # 36 | # Extension Attribute for Casper Suite. 37 | # 38 | # DESCRIPTION 39 | # 40 | # Will list all local users with Administrator privileges, and respond with an array up to the JSS. 41 | # This can be used to target computers with too many local admins. 42 | # 43 | # You may consider inputting your known admin users into the parameters to automatically skip. 44 | # Examples, your local standard IT user and/or the JAMF management account. 45 | # 46 | #################################################################################################### 47 | # 48 | # HISTORY 49 | # 50 | # Version: 1.0 51 | # 52 | # - Created by Douglas Worley, Senior Professional Services Engineer, JAMF Software on March 29 2016 53 | # 54 | #################################################################################################### 55 | 56 | the_group="admin" 57 | has_admin="No" 58 | allowedAdmin1="" 59 | allowedAdmin2="" 60 | 61 | [ "$4" != "" ] && [ "$allowedAdmin1" == "" ] && allowedAdmin1=$4 62 | [ "$5" != "" ] && [ "$allowedAdmin2" == "" ] && allowedAdmin2=$5 63 | 64 | # Check every user 65 | rslt=$(/usr/bin/dscl . -list /Users | while read each_username 66 | do 67 | if [ "${each_username}" != "root" ] && [ "${each_username}" != "$allowedAdmin1" ] && [ "${each_username}" != "$allowedAdmin2" ]; then 68 | member=$(/usr/bin/dsmemberutil checkmembership -U "${each_username}" -G "${the_group}" | cut -d " " -f 3) 69 | if [ "$member" == "a" ]; then 70 | if [ "$has_admin" == "No" ]; then 71 | has_admin="Yes" 72 | echo -n ${each_username} 73 | else 74 | echo -n ", ${each_username}" 75 | fi 76 | fi 77 | fi 78 | done) 79 | 80 | if [ "${rslt}" == "" ]; then 81 | echo "None" 82 | else 83 | echo "${rslt}" 84 | fi -------------------------------------------------------------------------------- /Policy Scripts/mdmReboot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #################################################################################################### 3 | # 4 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 5 | # 6 | # This script was written by the JAMF Software Profesional Services Team 7 | # 8 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 9 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 10 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 11 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 12 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 13 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 14 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 15 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 16 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 17 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 18 | # 19 | ##################################################################################################### 20 | # 21 | # SUPPORT FOR THIS PROGRAM 22 | # 23 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 24 | # information or support for this script, please contact your JAMF Software Account Manager. 25 | # 26 | ##################################################################################################### 27 | # 28 | # ABOUT THIS PROGRAM 29 | # 30 | # NAME 31 | # mdmReboot.sh 32 | # 33 | # SYNOPSIS - How to use 34 | # Run via a policy to complete a few last minute actions after Casper Imaging has completed. 35 | # 36 | # DESCRIPTION 37 | # 38 | # Verifies that APNS is working, and that we see a specific Configuration Profile matching a string to look for. 39 | # Run a `profiles -P -v` command to find the string you want to look for. This example searches for "loginwindow" 40 | # Best practices are to search for something that is scoped to All Computers. 41 | # 42 | # 43 | #################################################################################################### 44 | # 45 | # HISTORY 46 | # 47 | # Version: 1.0 48 | # 49 | # - Created by Douglas Worley, Professional Services Engineer, JAMF Software on May 10, 2013 50 | # 51 | #################################################################################################### 52 | 53 | configProfileString="loginwindow" # something like loginwindow 54 | if [ "$configProfileString" == "" ]; then 55 | echo "The variable configProfileString is blank. Please edit the script and enter a value to search for." 56 | exit 1 57 | fi 58 | 59 | # set up a loop until APNS pushes a specific configuration profile 60 | configProfileStatus=`profiles -P -v | grep "$configProfileString"` 61 | if [ "$configProfileStatus" != "" ] 62 | then echo "YES, Ready!" 63 | else 64 | until [ "$configProfileStatus" != "" ]; do 65 | echo "Waiting for config profile matching $configProfileString from APNS..." 66 | sleep 5 67 | configProfileStatus=`profiles -P -v | grep "$configProfileString"` 68 | done 69 | echo "$configProfileString Configuration Profile exists! Continuing..." 70 | fi 71 | 72 | # Once the above loop completes and the configuration profile exists, reboot to display the loginwindow banner 73 | echo "rebooting gracefully and submitting logs to JSS" && jamf reboot -background -immediately 74 | -------------------------------------------------------------------------------- /Policy Scripts/jamfHelperByPolicy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #################################################################################################### 3 | # 4 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 5 | # 6 | # This script was written by the JAMF Software Profesional Services Team 7 | # 8 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 9 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 10 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 11 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 12 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 13 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 14 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 15 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 16 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 17 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 18 | # 19 | ##################################################################################################### 20 | # 21 | # SUPPORT FOR THIS PROGRAM 22 | # 23 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 24 | # information or support for this script, please contact your JAMF Software Account Manager. 25 | # 26 | ##################################################################################################### 27 | # 28 | # ABOUT THIS PROGRAM 29 | # 30 | # NAME 31 | # jamfHelperByPolicy.sh 32 | # 33 | # SYNOPSIS - How to use 34 | # Run via a policy to populate JAMF Helper with values to present messages to the user. 35 | # 36 | # DESCRIPTION 37 | # 38 | # Populate script parameters to match the variables below. 39 | # Pass in values into these parameters during a policy. 40 | # 41 | #################################################################################################### 42 | # 43 | # HISTORY 44 | # 45 | # Version: 1.0 46 | # 47 | # - Created by Douglas Worley, Professional Services Engineer, JAMF Software on May 10, 2013 48 | # 49 | #################################################################################################### 50 | # The recursively named JAMF Helper help file is accessible at: 51 | # /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -help 52 | 53 | windowType="" # [hud | utility | fs] 54 | windowPosition="" # [ul | ll | ur | lr] 55 | title="" # "string" 56 | heading="" # "string" 57 | description="" # "string" 58 | icon="" # path 59 | iconSize="" # pixels 60 | timeout="" # seconds 61 | 62 | 63 | [ "$4" != "" ] && [ "$windowType" == "" ] && windowType=$4 64 | [ "$5" != "" ] && [ "$windowPosition" == "" ] && windowPosition=$5 65 | [ "$6" != "" ] && [ "$title" == "" ] && title=$6 66 | [ "$7" != "" ] && [ "$heading" == "" ] && heading=$7 67 | [ "$8" != "" ] && [ "$description" == "" ] && description=$8 68 | [ "$9" != "" ] && [ "$icon" == "" ] && icon=$9 69 | [ "$10" != "" ] && [ "$iconSize" == "" ] && iconSize=$10 70 | [ "$11" != "" ] && [ "$timeout" == "" ] && timeout=$11 71 | 72 | "/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfhelper" -windowType "$windowType" -windowPosition "$windowPosition" -title "$title" -heading "$heading" -description "$description" -icon "$icon" -iconSize "$iconSize" -button1 "Close" -defaultButton 1 -countdown "$timeout" -timeout "$timeout" 73 | -------------------------------------------------------------------------------- /Policy Scripts/logUserOut.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | #################################################################################################### 4 | # 5 | # Copyright (c) 2014, JAMF Software, LLC. All rights reserved. 6 | # 7 | # This script was written by the JAMF Software Profesional Services Team 8 | # 9 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 10 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 11 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 12 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 13 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 14 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 15 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 16 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 17 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 18 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19 | # 20 | ##################################################################################################### 21 | # 22 | # SUPPORT FOR THIS PROGRAM 23 | # 24 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 25 | # information or support for this script, please contact your JAMF Software Account Manager. 26 | # 27 | ##################################################################################################### 28 | # 29 | # ABOUT THIS PROGRAM 30 | # 31 | # NAME 32 | # logUserOut.sh 33 | # 34 | # Usage - Run this script in a policy to have Mac OS X log the current user out. 35 | # 36 | # By default the script will prompt the user to log out, but if the JAMF Policy parameter passes in a YES, 37 | # then perform a silent logout. 38 | # 39 | # This is helpful in combination with FileVault 2 policies activated "At Next Logout". 40 | # 41 | # If you have your FV2 policy run via Self Service, then the default "NO" setting is best. 42 | # If you have your FV2 policy running silently, then either hardcode the variable below or use a policy parameter 43 | # 44 | #################################################################################################### 45 | # 46 | # HISTORY 47 | # 48 | # Version: 1.0 49 | # 50 | # - Created by Douglas Worley, Senior Professional Services Engineer, JAMF Software on February 20 2016 51 | # 52 | #################################################################################################### 53 | 54 | silentLogoutYN="N" #yes/YES/y/Y/no/NO/n/N 55 | 56 | # Override whatever the hardcoded selection for $silentLogoutYN with whatever comes from the JSS 57 | [ "$4" != "" ] && silentLogoutYN=$4 58 | 59 | ################# 60 | 61 | CurrentUser=$(ls -l /dev/console | awk '{print $3}'); echo "$CurrentUser" 62 | 63 | 64 | ## Functions ### 65 | 66 | function myLogger (){ 67 | tee >(logger) <<< $1 68 | } 69 | 70 | function SilentLogout () { 71 | myLogger " Peforming Silent Logout" 72 | su \- "${CurrentUser}" -c osascript -e < $xmlPath 83 | 84 | 85 | 86 | $BUILDING 87 | 88 | 89 | EndXML 90 | 91 | ########## Post XML file to JSS ########## 92 | curl -sk -u $apiUser:$apiPass $jssUrl/JSSResource/computers/serialnumber/"${serial}"/subset/location -T $xmlPath -X PUT 93 | echo "" 94 | ########## Clean up temp files ########## 95 | # cat $xmlPath 96 | rm -rf $xmlPath -------------------------------------------------------------------------------- /API Scripts/changeSiteJssApi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # clear 4 | # set -x 5 | #################################################################################################### 6 | # 7 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 8 | # 9 | # This script was written by the JAMF Software Profesional Services Team 10 | # 11 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 12 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 13 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 15 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 16 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 17 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 18 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 19 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 20 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | ##################################################################################################### 23 | # 24 | # SUPPORT FOR THIS PROGRAM 25 | # 26 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 27 | # information or support for this script, please contact your JAMF Software Account Manager. 28 | # 29 | ##################################################################################################### 30 | # 31 | # ABOUT THIS PROGRAM 32 | # 33 | # NAME 34 | # changeSiteJssApi.sh 35 | # 36 | # SYNOPSIS - How to use 37 | # 38 | # Run in a policy or by hand to update a Mac's record in the JSS. 39 | # All three parameters/variables must be populated in order to work. 40 | # The SITE variable must match exactly how it is spelled in the JSS. 41 | # 42 | #################################################################################################### 43 | # 44 | # HISTORY 45 | # 46 | # Version: 1.0 47 | # 48 | # - Created by Douglas Worley, Senior Professional Services Engineer, JAMF Software on April 7 2016 49 | # Inspired by a script by Lucas Vance, Strategic Technical Account Manager, JAMF Software. 50 | # 51 | #################################################################################################### 52 | # Enter full URL and credentials to the JSS 53 | apiUser="" 54 | apiPass="" 55 | SITE="" 56 | 57 | #################################################################################################### 58 | # 59 | # DO NOT MODIFY BELOW THIS LINE! 60 | # 61 | #################################################################################################### 62 | 63 | ########## Read in parameters from the policy ########## 64 | 65 | if [ "$4" != "" ] && [ "$apiUser" == "" ]; then 66 | apiUser=$4 67 | fi 68 | if [ "$5" != "" ] && [ "$apiPass" == "" ]; then 69 | apiPass=$5 70 | fi 71 | if [ "$6" != "" ] && [ "$SITE" == "" ]; then 72 | SITE=$6 73 | fi 74 | 75 | ########## Read values from the managed Mac to pass into the API PUT ########## 76 | # jssUrl="" 77 | jssUrl=`defaults read /Library/Preferences/com.jamfsoftware.jamf.plist jss_url | sed s'/.$//'` 78 | serial=`system_profiler SPHardwareDataType | awk '/Serial/ {print $4}'` 79 | xmlPath='/tmp/tmp.xml' 80 | 81 | ########## Create our XML file for API PUT ########## 82 | cat < $xmlPath 83 | 84 | 85 | 86 | 87 | $SITE 88 | 89 | 90 | 91 | EndXML 92 | 93 | ########## Post XML file to JSS ########## 94 | curl -sk -u $apiUser:$apiPass $jssUrl/JSSResource/computers/serialnumber/"${serial}"/subset/general -T $xmlPath -X PUT 95 | echo "" 96 | ########## Clean up temp files ########## 97 | # cat $xmlPath 98 | rm -rf $xmlPath 99 | 100 | -------------------------------------------------------------------------------- /Policy Scripts/installAllCertsInPath.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | function myLogger (){ 3 | # this function sends messages to stdout as well as system.log 4 | # use as you would echo 5 | tee >(logger) <<< $1 6 | } 7 | [ $EUID != 0 ] && myLogger "This script requires root privileges, please run \"sudo $0\"" && exit 1 8 | #################################################################################################### 9 | # 10 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 11 | # 12 | # This script was written by the JAMF Software Profesional Services Team 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 15 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 18 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | # 25 | ##################################################################################################### 26 | # 27 | # SUPPORT FOR THIS PROGRAM 28 | # 29 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 30 | # information or support for this script, please contact your JAMF Software Account Manager. 31 | # 32 | ##################################################################################################### 33 | # 34 | # ABOUT THIS PROGRAM 35 | # 36 | # NAME 37 | # installAllCertsInPath.sh 38 | # 39 | # SYNOPSIS - How to use 40 | # Include in a Composer pkg project as a "preflight" script. 41 | # 42 | # USAGE - Populate these two variables: 43 | # 1) certPath 44 | # This is the directory containing all certs to import. 45 | # Do not use \, use quotes to handle spaces in the path. 46 | # Make sure to include the / at the end. 47 | # Example: "/var/db/my certificates/" 48 | certPath="/var/db/my certificates/" 49 | # 2) keyChain 50 | # This is the full path to the Keychain file for the script to import into: 51 | # Example: "/Library/Keychains/System.keychain" 52 | keyChain="/Library/Keychains/System.keychain" 53 | # 54 | #################################################################################################### 55 | # 56 | # HISTORY 57 | # 58 | # Version: 1.0 59 | # 60 | # - Created by Douglas Worley, Professional Services Engineer, JAMF Software on November 30, 2015 61 | # 62 | #################################################################################################### 63 | 64 | 65 | ### DO NOT EDIT BELOW THIS LINE ### 66 | cd "$certPath" 67 | myLogger "* Working with certificates located at: `pwd`/" 68 | myLogger "* Working with keychain located at: $keyChain" 69 | 70 | # Set up a "for loop" to find all certs in the folder and install them: 71 | function installTheCerts (){ 72 | for cert in "$certPath"* ; do 73 | cert=${cert##*/} # cleans up the filename 74 | echo "" 75 | myLogger "* Installing certificate: ${cert}" 76 | # myLogger "* Full certificate path: ${certPath}${cert}" 77 | security add-trusted-cert -d -r trustRoot -k "$keyChain" "${certPath}${cert}" # Does the thing. 78 | if [ "$?" == "0" ]; then #error checking 79 | myLogger "* Successfully installed cert: ${cert}" 80 | else 81 | myLogger "** There was a problem with installing certificate: ${cert}" 82 | fi 83 | done 84 | } 85 | 86 | # Do some basic error checking and install all of the certs in the specified folder 87 | if [[ "$certPath" != "" ]]; then 88 | installTheCerts #run the function above 89 | else 90 | myLogger "** Variable 'certPath' is blank. Edit the script and run again." 91 | exit 1 92 | fi 93 | -------------------------------------------------------------------------------- /Policy Scripts/aameeSerializingScript.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | 3 | 4 | #################################################################################################### 5 | # 6 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 7 | # 8 | # This script was written by the JAMF Software Profesional Services Team 9 | # 10 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 11 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 12 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 13 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 14 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 15 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 16 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 17 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 18 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 19 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 20 | # 21 | ##################################################################################################### 22 | # 23 | # SUPPORT FOR THIS PROGRAM 24 | # 25 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 26 | # information or support for this script, please contact your JAMF Software Account Manager. 27 | # 28 | ##################################################################################################### 29 | # 30 | # ABOUT THIS PROGRAM 31 | # 32 | # NAME 33 | # aameeSerializingScript.sh 34 | # 35 | # SYNOPSIS - How to use 36 | # 37 | # A - Build the Composer Package 38 | # 1) Use the Adobe Application Manager Enterprise Edition to create a “Serialization File" 39 | # 2) Use Composer.app to create a package for the two files created in step 1. Example: 40 | # /tmp/CS6_DWP/AdobeSerialization 41 | # /tmp/CS6_DWP/prov.xml 42 | # 2a) Set ownership/permissions of these two files to root:admin, 755 43 | # 3) Build Composer Source as DMG, upload to Casper Suite. 44 | # 45 | # B - Use the Script and Policy 46 | # 1) Upload this script to the JSS, and set the following details in the script metadata: 47 | # - run "After" 48 | # - $4 parameter = AdobeSerializationPath 49 | # - $5 parameter = provXmlPath 50 | # 2) Add the package and script into a policy 51 | # 3) Match the $4 and $5 parameters with the full absolute file paths of the two files from the package built in Composer above. 52 | # 53 | # Relevant links: 54 | # http://www.adobe.com/devnet/creativesuite/enterprisedeployment.html 55 | # 56 | # 57 | # 58 | ############################################################################################ 59 | # 60 | # HISTORY 61 | # 62 | # Version: 1.0 63 | # 64 | # - Created by Douglas Worley, Professional Services Engineer, JAMF Software on August 25 2015 65 | # 66 | ############################################################################################ 67 | 68 | AdobeSerializationPath="" 69 | provXmlPath="" 70 | 71 | if [[ "$4" != "" ]] && [[ "$AdobeSerializationPath" == "" ]]; then 72 | AdobeSerializationPath=$4 73 | fi 74 | if [[ "$5" != "" ]] && [[ "$provXmlPath" == "" ]]; then 75 | provXmlPath=$5 76 | fi 77 | 78 | echo "AdobeSerializationPath is $AdobeSerializationPath" 79 | echo "provXmlPath is $provXmlPath" 80 | 81 | "${AdobeSerializationPath}" --tool=VolumeSerialize --stream -provfile="${provXmlPath}" 82 | if [ "$?" == "0" ]; then #error checking 83 | echo "Successfully ran AdobeSerialization tool!" 84 | else 85 | echo "ALERT - There was a problem with running the AdobeSerialization tool..." 86 | fi 87 | 88 | rm $AdobeSerializationPath && rm $provXmlPath 89 | if [ "$?" == "0" ]; then #error checking 90 | echo "Successfully deleted AdobeSerialization and prov.xml files" 91 | else 92 | echo "ALERT - There was a problem with deleting AdobeSerialization and prov.xml files..." 93 | fi -------------------------------------------------------------------------------- /Policy Scripts/openAppAsRoot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #################################################################################################### 4 | # 5 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 6 | # 7 | # This script was written by the JAMF Software Profesional Services Team 8 | # 9 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 10 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 11 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 12 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 13 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 14 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 15 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 16 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 17 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 18 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19 | # 20 | ##################################################################################################### 21 | # 22 | # SUPPORT FOR THIS PROGRAM 23 | # 24 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 25 | # information or support for this script, please contact your JAMF Software Account Manager. 26 | # 27 | ##################################################################################################### 28 | # 29 | # ABOUT THIS PROGRAM 30 | # 31 | # NAME 32 | # openAppAsRoot.sh 33 | # 34 | # SYNOPSIS - How to use 35 | # 36 | # Run this script locally in a shell with sudo privileges or with a JAMF Policy 37 | # 38 | # DESCRIPTION 39 | # 40 | # This script reads in an application name and then preps the app to be opened with Root privileges. 41 | # 42 | # Example - Correct: Safari 43 | # Incorrect: Safari.app 44 | # 45 | # 46 | # USAGE 47 | # 48 | # $4 parameter - do not include the .app extension. 49 | # $5 parameter - defaults to /Applications, but you can specify an alternat enclosing folder. 50 | # 51 | #################################################################################################### 52 | # 53 | # HISTORY 54 | # 55 | # Version: 1.0 56 | # - Created by Douglas Worley, Professional Services Engineer, JAMF Software on April 7, 2014 57 | # 58 | #################################################################################################### 59 | clear 60 | 61 | app="" 62 | appPath="/Applications" 63 | 64 | if [ "$4" != "" ] && [ "$app" == "" ]; then 65 | app=$4 66 | fi 67 | if [ "$5" != "" ] ; then 68 | appPath=$5 69 | fi 70 | 71 | fullAppName="$appPath/${app}.app/Contents/MacOS/${app}" 72 | APPLICATION="$appPath/${app}.app" 73 | 74 | echo "working with ${APPLICATION}" 75 | chflags -R nouchg "${APPLICATION}" 76 | if [ "$?" == "0" ]; then 77 | echo " chflags removed on ${APPLICATION}" 78 | else 79 | echo "* There was a problem removing chflags" 80 | fi 81 | xattr -d com.apple.quarantine "${APPLICATION}" 82 | if [ "$?" == "0" ]; then 83 | echo " removed quarantine bit on ${APPLICATION}" 84 | else 85 | echo "* There was a problem removing the quarantine bit on ${APPLICATION}" 86 | fi 87 | chmod -R +x "${APPLICATION}" 88 | if [ "$?" == "0" ]; then 89 | echo " set execute bit on ${APPLICATION}" 90 | else 91 | echo "* There was a problem setting the execute bit on ${APPLICATION}" 92 | fi 93 | 94 | sudo -u root "$fullAppName" & 95 | if [ "$?" == "0" ]; then 96 | echo " opened application '${fullAppName}' at binary level as root" 97 | else 98 | echo "* There was a problem opening application '${fullAppName}' at binary level as root" 99 | fi 100 | 101 | sleep 1 102 | 103 | theApp="${app}" 104 | osascript -e "tell application \"$theApp\" to activate" 105 | if [ "$?" == "0" ]; then 106 | echo " bringing application ${theApp} to front" 107 | else 108 | echo "* There was a problem bringing application ${theApp} to front" 109 | fi 110 | 111 | exit 0 -------------------------------------------------------------------------------- /Policy Scripts/dnsFlush.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | clear 3 | # set -x 4 | 5 | #!/bin/bash 6 | # 7 | #################################################################################################### 8 | # 9 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 10 | # 11 | # This script was written by the JAMF Software Profesional Services Team 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 14 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 17 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | # 24 | ##################################################################################################### 25 | # 26 | # SUPPORT FOR THIS PROGRAM 27 | # 28 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 29 | # information or support for this script, please contact your JAMF Software Account Manager. 30 | # 31 | ##################################################################################################### 32 | # 33 | # ABOUT THIS PROGRAM 34 | # 35 | # NAME 36 | # dnsFlush.sh 37 | # 38 | # SYNOPSIS - How to use 39 | # 40 | # This script will query the operating system on the Mac then choose the appropriate method to flush DNS. 41 | # 42 | # You can hard code the OS for testing purposes. 43 | # 44 | # 45 | # 46 | # 47 | #################################################################################################### 48 | # 49 | # HISTORY 50 | # 51 | # Version: 1.0 52 | # 53 | # - Created by Douglas Worley, Senior Professional Services Engineer, JAMF Software on June 13 2016 54 | # 55 | #################################################################################################### 56 | 57 | # Taken from: https://coolestguidesontheplanet.com/clear-the-local-dns-cache-in-osx/ 58 | 59 | function myLogger (){ 60 | # This function sends messages to stdout as well as syslog 61 | # Use as you would myLogger 62 | tee >(logger) <<< $1 63 | } 64 | 65 | os_full_vers=$(sw_vers -productVersion) # full version, ex “10.10.3" 66 | # os_full_vers=10.10.3 #### TESTING ONLY - you can hard code the variable here. Keep this line commented most of the time 67 | os_minor_vers=$(myLogger $os_full_vers | awk -F. '{print $2}') # single digit identifier, ex “10" 68 | os_point_release=$(myLogger $os_full_vers | awk -F. '{print $3}') # single digit identifier, ex “3" 69 | 70 | 71 | myLogger "Full OS version is: $os_full_vers" 72 | myLogger "OS Minor version is: $os_minor_vers" 73 | myLogger "OS Point release is: $os_point_release" 74 | myLogger "" 75 | 76 | if [[ "$os_minor_vers" == 10 ]]; then 77 | if [[ "$os_point_release" -eq 0 || "$os_point_release" -eq 1 || "$os_point_release" -eq 2 || "$os_point_release" -eq 3 ]]; then 78 | sudo discoveryutil mdnsflushcache 79 | 80 | if [ "$?" == "0" ]; then #error checking 81 | myLogger "Successfully flushed DNS with discoveryutil" 82 | else 83 | myLogger "There was a problem with flushing DNS with discoveryutil" 84 | exit "$?" 85 | fi 86 | elif [[ "$os_point_release" -eq 4 ]]; then 87 | killall -HUP mDNSResponder 88 | 89 | if [ "$?" == "0" ]; then #error checking 90 | myLogger "Successfully flushed DNS with mDNSResponder" 91 | else 92 | myLogger "There was a problem with flushing DNS with mDNSResponder" 93 | exit "$?" 94 | fi 95 | fi 96 | elif [[ "$os_minor_vers" -eq 5 || "$os_minor_vers" -eq 6 ]]; then 97 | dscacheutil -flushcache 98 | 99 | if [ "$?" == "0" ]; then #error checking 100 | myLogger "Successfully flushed DNS with dscacheutil" 101 | else 102 | myLogger "There was a problem with flushing DNS with dscacheutil" 103 | exit "$?" 104 | fi 105 | else 106 | killall -HUP mDNSResponder 107 | 108 | if [ "$?" == "0" ]; then #error checking 109 | myLogger "Successfully flushed DNS with mDNSResponder" 110 | else 111 | myLogger "There was a problem with flushing DNS with mDNSResponder" 112 | exit "$?" 113 | fi 114 | fi -------------------------------------------------------------------------------- /Policy Scripts/fvStatusJamfHelper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | #################################################################################################### 4 | # 5 | # Copyright (c) 2015, JAMF Software, LLC. All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # * Neither the name of the JAMF Software, LLC nor the 15 | # names of its contributors may be used to endorse or promote products 16 | # derived from this software without specific prior written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 19 | # EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 22 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | #################################################################################################### 30 | # 31 | # ABOUT THIS PROGRAM 32 | # 33 | # NAME 34 | # fvStatusJamfHelper.sh 35 | # 36 | # SYNOPSIS - How to use 37 | # 38 | # 39 | # Run this script either in Self Service or by silent policy. 40 | # 41 | 42 | # 43 | # 44 | # DESCRIPTION 45 | # 46 | # This script works best in policies scoped to machines that have completed a FV policy 47 | # but still aren’t encrypted. 48 | # 49 | # 50 | # 51 | # 52 | #################################################################################################### 53 | # 54 | # HISTORY 55 | # 56 | # Version: 1.0 57 | # 58 | # - Created by Douglas Worley, Senior Professional Services Engineer, JAMF Software on December 7 2016 59 | # 60 | #################################################################################################### 61 | 62 | fvStatus=$(fdesetup status) 63 | 64 | windowType="utility" 65 | title="Acme IT" 66 | heading="FileVault Encryption" 67 | icon="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/FileVaultIcon.icns" 68 | description="${fvStatus}" 69 | timeout="100" 70 | countdown="" 71 | 72 | if [[ "$fvStatus" == "FileVault is On." ]]; then 73 | description="Your disk is fully encrypted. Press \"Update Apps\" to refresh Self Service." 74 | 75 | button=$( "/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfhelper" \ 76 | -windowType "$windowType" -windowPosition "$windowPosition" -title "$title" \ 77 | -heading "$heading" -description "$description" -countdown "$countdown" \ 78 | -timeout "$timeout" -icon "$icon" -iconSize "$iconSize" \ 79 | -button1 "Close" -button2 "Update Apps" -defaultButton 1 80 | ) 81 | if [[ $button = 2 ]]; then 82 | jamf recon & 83 | fi 84 | elif [[ "$fvStatus" == *Deferred* ]]; then 85 | description="Your disk is prepped for encryption. Press \"Restart\" to log out and enable encryption. You will need to enter your password to continue." 86 | 87 | button=$( "/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfhelper" \ 88 | -windowType "$windowType" -windowPosition "$windowPosition" -title "$title" \ 89 | -heading "$heading" -description "$description" -countdown "$countdown" \ 90 | -timeout "$timeout" -icon "$icon" -iconSize "$iconSize" \ 91 | -button1 "Close" -button2 "Restart" -defaultButton 1 92 | ) 93 | if [[ $button = 2 ]]; then 94 | osascript -e 'tell application "System Events" to restart' 95 | fi 96 | else 97 | "/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfhelper" \ 98 | -windowType "$windowType" -windowPosition "$windowPosition" -title "$title" \ 99 | -heading "$heading" -description "$description" -countdown "$countdown" \ 100 | -timeout "$timeout" -icon "$icon" -iconSize "$iconSize" \ 101 | -button1 "Close" -defaultButton 1 102 | fi 103 | 104 | 105 | -------------------------------------------------------------------------------- /API Scripts/changeExtensionAttributeJssApi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #################################################################################################### 4 | # 5 | # Copyright (c) 2015, JAMF Software, LLC. All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # * Neither the name of the JAMF Software, LLC nor the 15 | # names of its contributors may be used to endorse or promote products 16 | # derived from this software without specific prior written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 19 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 22 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | #################################################################################################### 30 | # 31 | # SUPPORT FOR THIS PROGRAM 32 | # 33 | # This program is distributed "as is" by JAMF Software. 34 | # 35 | #################################################################################################### 36 | # 37 | # AUTHOR 38 | # Original version by Lucas Vance, October 2015 39 | # Modified by Douglas Worley to allow parameters, discovery of JSS settings. Feb 2016 40 | # 41 | #################################################################################################### 42 | 43 | #################################################################################################### 44 | # 45 | # HARDCODED VARIABLES 46 | # These values may be hard coded for your specific environment, or may be passed in by parameters 47 | # 48 | #################################################################################################### 49 | # Enter full URL and credentials to the JSS 50 | apiUser="" 51 | apiPass="" 52 | # Enter ID number of the EA 53 | eaID="" 54 | # Enter the exact Display Name of the Extension Attribute (must be exactly how is in JSS) 55 | eaName="" 56 | # Enter desired value for the EA (must match available values in JSS) 57 | value="" 58 | 59 | 60 | 61 | #################################################################################################### 62 | # 63 | # DO NOT MODIFY BELOW THIS LINE! 64 | # 65 | #################################################################################################### 66 | 67 | ########## Read in parameters from the policy ########## 68 | 69 | if [ "$4" != "" ] && [ "$apiUser" == "" ]; then 70 | apiUser=$4 71 | fi 72 | if [ "$5" != "" ] && [ "$apiPass" == "" ]; then 73 | apiPass=$5 74 | fi 75 | if [ "$6" != "" ] && [ "$eaID" == "" ]; then 76 | eaID=$6 77 | fi 78 | if [ "$7" != "" ] && [ "$eaName" == "" ]; then 79 | eaName=$7 80 | fi 81 | if [ "$8" != "" ] && [ "$value" == "" ]; then 82 | value=$8 83 | fi 84 | 85 | ########## Read values from the managed Mac to pass into the API PUT ########## 86 | 87 | jssUrl=`defaults read /Library/Preferences/com.jamfsoftware.jamf.plist jss_url | sed s'/.$//'` 88 | serial=`system_profiler SPHardwareDataType | awk '/Serial/ {print $4}'` 89 | xmlPath='/tmp/tmp.xml' 90 | 91 | ########## Create our XML file for API PUT ########## 92 | cat < $xmlPath 93 | 94 | 95 | 96 | 97 | $eaID 98 | $eaName 99 | String 100 | $value 101 | 102 | 103 | 104 | EndXML 105 | 106 | ########## Post XML file to JSS ########## 107 | curl -sk -u $apiUser:$apiPass $jssUrl/JSSResource/computers/serialnumber/"${serial}"/subset/extensionattributes -T $xmlPath -X PUT 108 | 109 | ########## Clean up temp files ########## 110 | rm -rf $xmlPath -------------------------------------------------------------------------------- /Policy Scripts/gateKeeperTrustAppList.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | clear 3 | #set -x 4 | #################################################################################################### 5 | # 6 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 7 | # 8 | # This script was written by the JAMF Software Profesional Services Team 9 | # 10 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 11 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 12 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 13 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 14 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 15 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 16 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 17 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 18 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 19 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 20 | # 21 | ##################################################################################################### 22 | # 23 | # SUPPORT FOR THIS PROGRAM 24 | # 25 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 26 | # information or support for this script, please contact your JAMF Software Account Manager. 27 | # 28 | ##################################################################################################### 29 | # 30 | # ABOUT THIS PROGRAM 31 | # 32 | # NAME 33 | # gateKeeperTrustAppList.sh 34 | # 35 | # SYNOPSIS - How to use 36 | # Update the array below in your favorite text editor, then run the script in a shell or in a policy. 37 | # 38 | # USAGE - Populate two values: 39 | # 40 | # gatekeeperLabel 41 | # This is the value to be appended to each app, then trusted by Gatekeeper as a whole. 42 | # Example: 43 | # gatekeeperLabel="MyApprovedApps" 44 | # 45 | # 46 | # allOfTheApps 47 | # This is an array containing the absolute path of each application, one per line. 48 | # Each app path can contain spaces, and needs to be enclosed in "double quotes". 49 | # Example: 50 | # allOfTheApps=( 51 | # "/Applications/HandBrake.app" 52 | # "/Applications/Sublime Text.app" 53 | # ) 54 | # 55 | # ################################################################################################## 56 | # 57 | # HISTORY 58 | # 59 | # Version: 1.0 60 | # 61 | # - Created by Douglas Worley, Professional Services Engineer, JAMF Software on November 30, 2015 62 | # 63 | #################################################################################################### 64 | 65 | 66 | ### Specify the label to be allowed, and all of the above apps to be added to: 67 | gatekeeperLabel="MyApprovedApps" 68 | 69 | 70 | ### Input all full application paths, one per line, each path enclosed inside quotes. 71 | ### It doesn't matter if the app is not installed on the Mac, logic below will only only approve the app if it exists. 72 | allOfTheApps=( 73 | "/Applications/HandBrake.app" 74 | "/Applications/Sublime Text.app" 75 | ) 76 | 77 | ###### DO NOT MODIFY CODE BELOW THIS LINE ####### 78 | 79 | 80 | ### Set global Gatekeeper settings 81 | spctl --master-enable 82 | if [ "$?" == "0" ]; then #error checking 83 | echo " Set Gatekeeper to only allow trusted applications" 84 | else 85 | echo "ALERT - There was a problem with setting GateKeeper to allow only trusted applications" 86 | exit "$?" 87 | fi 88 | 89 | ### Run through each of the apps in the list at the top, and take action on them, but only they exist on the Mac. 90 | IFS="" 91 | for eachApp in ${allOfTheApps[*]} 92 | do 93 | if [ -e "${eachApp}" ]; then 94 | echo " - Approving application: ${eachApp}" 95 | spctl --add --label "$gatekeeperLabel" "${eachApp}" 96 | if [ "$?" == "0" ]; then #error checking 97 | echo " Set Gatekeeper to trust ${eachApp}" 98 | else 99 | echo "ALERT - There was a problem with setting GateKeeper to trust ${eachApp}" 100 | fi 101 | chown root:wheel "${eachApp}" 102 | if [ "$?" == "0" ]; then #error checking 103 | echo " Set ownership for ${eachApp}" 104 | else 105 | echo "ALERT - There was a problem with setting ownership for ${eachApp}" 106 | fi 107 | fi 108 | done 109 | 110 | ### enable the label for use by GateKeeper 111 | spctl --enable --label "$gatekeeperLabel" 112 | if [ "$?" == "0" ]; then #error checking 113 | echo " Enabled Gatekeeper label: $gatekeeperLabel" 114 | else 115 | echo "ALERT - There was a problem with enabling GateKeeper label: $gatekeeperLabel" 116 | exit "$?" 117 | fi 118 | 119 | ### Pretty clean up to the operator of the script: 120 | echo "" 121 | echo "***** GateKeeper Status ****" 122 | spctl --status 123 | echo "" 124 | -------------------------------------------------------------------------------- /Manual Scripts/moveUserHome.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | clear 3 | #set -x 4 | #################################################################################################### 5 | # 6 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 7 | # 8 | # This script was written by the JAMF Software Profesional Services Team 9 | # 10 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 11 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 12 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 13 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 14 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 15 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 16 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 17 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 18 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 19 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 20 | # 21 | ##################################################################################################### 22 | # 23 | # SUPPORT FOR THIS PROGRAM 24 | # 25 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 26 | # information or support for this script, please contact your JAMF Software Account Manager. 27 | # 28 | ##################################################################################################### 29 | # 30 | # ABOUT THIS PROGRAM 31 | # 32 | # NAME 33 | # userHomeFix.sh 34 | # 35 | # SYNOPSIS - How to use 36 | # 37 | # Run this script by hand, do not run in a policy. 38 | # 39 | # This script is meant for an admin operator to run by hand and move a user home folder 40 | # from a local (Deleted) state to a domain user. 41 | # 42 | # Verify that the "companyDomainName" variable populates properly with whatever your domain name is. 43 | # If the script below does not properly read your domain name, you can hard code it. 44 | # 45 | # 46 | ############################################################################################ 47 | # 48 | # HISTORY 49 | # 50 | # Version: 1.0 51 | # 52 | # - Created by Douglas Worley, Senior Professional Services Engineer, JAMF Software on March 23 2016 53 | # 54 | ############################################################################################ 55 | 56 | # companyDomainFullName="" 57 | # companyDomainShortName="" 58 | 59 | companyDomainFullName=`dsconfigad -show | awk '/Active Directory Domain/ {print $5}'` 60 | companyDomainShortName=`dscl /Search/Contacts -read / CSPSearchPath SearchPolicy | grep Active | cut -c 20- | rev | cut -c 13- | rev` 61 | if [[ $companyDomainFullName == "" ]]; then 62 | echo " Error  63 | This computer is not bound. Please bind to AD and retry." 64 | exit $? 65 | fi 66 | 67 | 68 | function getUsersDirView() { 69 | usersDirList=`ls -alh /Users` 70 | } 71 | getUsersDirView 72 | 73 | echo "*********************************************************** 74 |  Before View  75 | 76 | $usersDirList" 77 | echo " 78 | *********************************************************** 79 | *** Choose home folder to migrate (you can copy/paste): ***" 80 | read homeFolder 81 | echo " Step 1 - Operator chose home folder: '$homeFolder' " 82 | echo "" & echo "" 83 | echo "*** Enter $companyDomainFullName domain user account to assign to the home folder: ***" 84 | read userName 85 | echo " Step 2 - Operator chose domain user: '$userName' " 86 | echo "" 87 | 88 | mv "/Users/$homeFolder" "/Users/$userName" 89 | if [[ $? == "0" ]]; then 90 | echo " Successfully changed name of /Users/$userName" 91 | else 92 | echo " Error  93 | There was a problem changing name of /Users/$userName" 94 | exit $? 95 | fi 96 | chown -R "$userName:$companyDomainShortName\Domain Users" "/Users/$userName" 97 | if [[ $? == "0" ]]; then 98 | echo " Successfully changed permissions on /Users/$userName" 99 | else 100 | echo " Error  101 | There was a problem changing permissions on /Users/$userName." 102 | exit $? 103 | fi 104 | 105 | /usr/bin/find /Applications -uid $userName -exec chown "$userName:$companyDomainShortName\Domain Users" {} \; 106 | if [[ $? == "0" ]]; then 107 | echo " Successfully changed permissions of Applications owned by $userName" 108 | else 109 | echo " Error  110 | There was a problem changing permissions on Applications owned by $userName." 111 | exit $? 112 | fi 113 | 114 | getUsersDirView 115 | userHomePerms=`ls -alh /Users/ | grep $userName | awk '{print $3}'` 116 | 117 | echo " 118 | 119 | *********************************************************** 120 |  Result  121 | 122 | Home folder for '$userName' is now owned by user: '$userHomePerms'. 123 | Does this look correct? 124 | 125 | *********************************************************** 126 |  After View  127 | $usersDirList 128 | 129 | Please verify that the name of the home folder matches the ownership. 130 | Please verify that there are no errors above. 131 | 132 | *********************************************************** 133 | " -------------------------------------------------------------------------------- /Enrollment Scripts/ard_checkAndEnroll.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | clear 3 | #################################################################################################### 4 | # 5 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 6 | # 7 | # This script was written by the JAMF Software Profesional Services Team 8 | # 9 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 10 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 11 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 12 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 13 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 14 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 15 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 16 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 17 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 18 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19 | # 20 | ##################################################################################################### 21 | # 22 | # SUPPORT FOR THIS PROGRAM 23 | # 24 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 25 | # information or support for this script, please contact your JAMF Software Account Manager. 26 | # 27 | ##################################################################################################### 28 | # 29 | # ABOUT THIS PROGRAM 30 | # 31 | # NAME 32 | # ard_checkAndEnroll.sh 33 | # 34 | # SYNOPSIS - How to use 35 | # 36 | # Run this script using Apple Remote Desktop to have the Mac check if it is managed, and if not enroll itself. 37 | # 38 | # DESCRIPTION 39 | # 40 | # This script check for the existence of the jamf binary. 41 | # If the jamf binary is missing, the script curls and runs a reusable QuickAdd.pkg that has been hidden somewhere. 42 | # 43 | # 44 | # USAGE 45 | # 46 | # 1) Create a reusable QuickAdd package with Recon.app, 47 | # 2) Hide that QuickAdd somewehere publicly visible on the Internet. 48 | # 2a) A common path could be ///JSS/Tomcat/webapps/downloads/* inside your JSS. 49 | # 3) Update the Global Variables below in the to match your download location. 50 | # 4) Copy and paste this script into the "Send Unix Command", and make sure to "Run command" as the root user. 51 | # 4a) You can choose to "Save as Template..." for repeated use, and/or integrate into the ARD Task Server. 52 | # 53 | #################################################################################################### 54 | # 55 | # HISTORY 56 | # 57 | # Version: 1.0 58 | # - Created by Douglas Worley, Professional Services Engineer, JAMF Software on August 5, 2015 59 | # 60 | #################################################################################################### 61 | 62 | # set -x # DEBUG. Display commands and their arguments as they are executed 63 | # set -v # VERBOSE. Display shell input lines as they are read. 64 | # set -n # EVALUATE. Check syntax of the script but dont execute 65 | 66 | 67 | 68 | ######################## 69 | # Global Variables 70 | 71 | downloadURL="https://jss.company.com:8443/downloads" # The path to the web folder hosting your zipped QuickAdd.pkg (created with Recon.app) 72 | workingPath="/tmp" # The local path on the Mac where the zipped QuickAdd.pkg will be downloaded and worked on. 73 | thePackage="QuickAdd_reusable.pkg" # The name of the QuickAdd.pkg 74 | theZipFile="QuickAdd_reusable.pkg.zip" # The name of the zipped QuickAdd.pkg 75 | 76 | ######################## 77 | 78 | echo "Moving to working directory at $workingPath" && cd "$workingPath" 79 | 80 | 81 | jamfBinaryStatus=`which jamf` # Check for the presence of the jamf binary 82 | if [ "$jamfBinaryStatus" != "" ]; then 83 | echo " JAMF Binary is present." 84 | jamfWorkingStatus=`jamf checkjssconnection` # Verify that the jamf binary actually works 85 | if [[ $jamfWorkingStatus == *"The JSS is available"* ]] ; then 86 | echo " The JSS is available." 87 | fi 88 | exit 0 89 | else 90 | echo "The JAMF Binary is not present. Attempting to remedy this." 91 | fi 92 | 93 | # clean up old versions 94 | if [ -e "$workingPath/$theZipFile" ]; 95 | then 96 | echo " Old version of zip file found at $workingPath/$theZipFile, removing..." 97 | rm -rf "$workingPath/$theZipFile" 98 | else 99 | echo " Old version of zip file not found at $workingPath/$theZipFile, continuing..." 100 | fi 101 | 102 | if [ -e "$workingPath/$thePackage" ]; 103 | then 104 | echo " Old version of pkg file found at $workingPath/$thePackage, removing..." 105 | rm -rf "$workingPath/$thePackage" 106 | else 107 | echo " Old version of pkg file not found at $workingPath/$thePackage, continuing..." 108 | fi 109 | 110 | cd $workingPath 111 | 112 | curl -O "$downloadURL/$theZipFile" # Download the zipped QuickAdd 113 | if [ "$?" == "0" ]; then 114 | echo " Downloaded the zipped package at $downloadURL/$theZipFile" 115 | else 116 | echo " There was a problem with downloading the zipped package" 117 | fi 118 | 119 | unzip -o "$workingPath/$theZipFile" > /dev/null & # Unzip the QuickAdd 120 | if [ "$?" == "0" ]; then 121 | echo " Unzipped the file to $workingPath/$theZipFile" 122 | else 123 | echo " There was a problem with unzipping the file at $workingPath/$theZipFile" 124 | fi 125 | 126 | installer -target / -pkg "$workingPath/$thePackage" # Run the QuickAdd 127 | if [ "$?" == "0" ]; then 128 | echo " Installed the package at $workingPath/$thePackage." 129 | echo " Enrollment to the JSS was successful." 130 | else 131 | echo " There was a problem with installing the package at $workingPath/$thePackage" 132 | echo " There was a problem enrolling with the JSS." 133 | fi 134 | 135 | echo "Cleaning up!" 136 | rm -rf "$workingPath/$thePackage" # Delete the old version of the QuickAdd package 137 | if [ "$?" == "0" ]; then 138 | echo " Deleted the package at $workingPath/$thePackage" 139 | else 140 | echo " There was a problem with deleting the package at $workingPath/$thePackage" 141 | fi 142 | rm -rf "$workingPath/$theZipFile" # Delete the old version of the Zip file 143 | if [ "$?" == "0" ]; then 144 | echo " Deleted the zip file at $workingPath/$theZipFile" 145 | else 146 | echo " There was a problem with deleting the zipfile at $workingPath/$theZipFile" 147 | fi -------------------------------------------------------------------------------- /API Scripts/jssApiObjectReport.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # v5 3 | reset 4 | #################################################################################################### 5 | # 6 | # Copyright (c) 2015, JAMF Software, LLC. All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions are met: 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # * Neither the name of the JAMF Software, LLC nor the 16 | # names of its contributors may be used to endorse or promote products 17 | # derived from this software without specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 20 | # EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 23 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | # 30 | #################################################################################################### 31 | 32 | ########## Description ########## 33 | ## 34 | # 35 | # This script generates a report via the API to get the count and names of each type of object. 36 | # This is useful for comparing two various instances when doing a migration. 37 | # 38 | # This script requires the name of a JSS object as displayed in the JSS API documentation page: 39 | # For example: https://jamf.company.com:8443/api/ 40 | # 41 | ## 42 | ########## End Description ########## 43 | 44 | 45 | ########## Usage ########## 46 | ## 47 | # 48 | # This script has three options for providing the required variables: 49 | # 1: Pass the variables in as shell parameters in line 50 | # 2: Be prompted for the variables during shell execution 51 | # 3: Hard code variables into this script file 52 | # 53 | # 54 | # How To Use: 55 | # 1) To pass the variables in with script parameters in one line, keep the variables below blank. 56 | # Then, provide the path to the script with the URL, user & resource in one line separated by spaces. 57 | # Example: 58 | # ./jssApiObjectReport.sh https://jamf.company.com:8443 ladmin scripts 59 | # For security reasons, the password will need to be provided separately. 60 | # 61 | # 2) To be prompted for the variables, just run the unmodified script by itself and the shell will do the rest. 62 | # 63 | # 3) To hard code variables you can fill them in under the Customization section. 64 | # This option is not recommended. 65 | # 66 | ## 67 | ########## End Usage ########## 68 | 69 | 70 | ########## Customization ########## 71 | ## 72 | 73 | ### If the values are left blank here, they will be prompted for during execution, or can be passed in as parameters. 74 | ### This option is not recommended. See Usage above. 75 | # JSS URL 76 | jssUrl="" 77 | # Full URL and credentials to the JSS. 78 | apiUser="" 79 | apiPass="" 80 | # Resource - needs to match how JSS spells the resource. 81 | apiResource="" 82 | ## 83 | ########## End Customization ########## 84 | 85 | 86 | ########## BODY OF SCRIPT - DO NOT MODIFY BELOW ########## 87 | ## 88 | 89 | # read parameters 90 | if [[ $jssUrl == "" ]]; then 91 | jssUrl=$1 92 | fi 93 | if [[ $apiUser == "" ]]; then 94 | apiUser=$2 95 | fi 96 | if [[ $apiResource == "" ]]; then 97 | apiResource=$3 98 | fi 99 | 100 | # Prompt the shell for variables if parameters are blank 101 | if [[ $jssUrl == "" ]]; then 102 | echo "Enter valid full JSS URL:" 103 | echo "example: https://jamf.company.com:8443" 104 | read jssUrl 105 | fi 106 | if [[ $apiUser == "" ]]; then 107 | echo "Enter valid API username:" 108 | read apiUser 109 | fi 110 | if [[ $apiPass == "" ]]; then 111 | echo "Enter valid API user password:" 112 | echo "(silent input)" 113 | read -s apiPass 114 | fi 115 | if [[ $apiResource == "" ]]; then 116 | echo "What API resource do you want to report on?" 117 | read apiResource 118 | fi 119 | 120 | # output shell contents to log file 121 | 122 | CurrentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'); echo "working with user $CurrentUser" 123 | CurrentUserHome=$(dscl . -read /Users/$CurrentUser NFSHomeDirectory 2>/dev/null | awk '{ print $2 }'); echo "working with user home: $CurrentUserHome" 124 | theDATE=$(date "+%Y_%m_%d"); echo "theDATE is $theDATE" 125 | theTIME=$(date "+%H:%M"); echo "theDATE is $theDATE" 126 | jssHostName=$(echo $jssUrl | sed 's/........//' | sed 's/[/]//'| cut -f1 -d":") 127 | 128 | logfilepath="$CurrentUserHome/Desktop/JSS_API_Report/" 129 | logfile="$jssHostName-$apiResource.txt" 130 | if [[ -e "$logfilepath" ]]; then 131 | echo "Log path already exists at $logfilepath" 132 | else 133 | mkdir -p $logfilepath 134 | echo "Creating log folder at $logfilepath" 135 | fi 136 | echo "Writing log file to $logfilepath$logfile" 137 | # here is the magic 138 | exec 2>&1 > >(tee $logfilepath$logfile) 139 | 140 | 141 | # generate count of resources: 142 | resourceCount=$(/usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/$apiResource | xpath //size 2>/dev/null | sed -e 's/\//g; s/\<\/size>//g') 143 | # generate list of resources: 144 | resourceNames=$(/usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/$apiResource | tidy -xml 2>/dev/null | sed -n 's|\(.*\)|\1|p' | sort -f) 145 | 146 | # display results to shell 147 | echo " 148 | ##### REPORT for $apiResource on $jssUrl ##### 149 | Date: $theDATE 150 | Time: $theTIME 151 | 152 |  $apiResource - Count:  153 | $resourceCount 154 | 155 |  $apiResource - Names:  156 | ${resourceNames} 157 | " 158 | 159 | ## 160 | ########## END BODY OF SCRIPT ########## 161 | 162 | # Raise attention ot the log files: 163 | # open "$logfilepath" 164 | # qlmanage -p "$logfilepath$logfile" & -------------------------------------------------------------------------------- /API Scripts/massUpdateComputerEaValues.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #set -x 3 | reset 4 | #################################################################################################### 5 | # 6 | # Copyright (c) 2013, JAMF Software, LLC. All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions are met: 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # * Neither the name of the JAMF Software, LLC nor the 16 | # names of its contributors may be used to endorse or promote products 17 | # derived from this software without specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 20 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 23 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | # 30 | #################################################################################################### 31 | # 32 | # ABOUT THIS PROGRAM 33 | # 34 | # NAME 35 | # massUpdateComputerEaValues.sh 36 | # 37 | # Create a CSV where: 38 | # Column A is a list of serial numbers 39 | # Column B is the value of the Extension Attribute (must be exactly how is in JSS) 40 | # 41 | # This CSV file will be passed to the "inputFile" parameter in the script. 42 | # 43 | # SYNOPSIS - with parameters 44 | # massUpdateComputerEaValues.sh 45 | # 46 | # The script will prompt for any of these parameters that are not hard coded into the file. 47 | # 48 | # DESCRIPTION 49 | # This script reads computer/client information from a CSV file and imports the data into the JSS. 50 | # 51 | #################################################################################################### 52 | # 53 | # HISTORY 54 | # 55 | # Version: 1.0 56 | # - Inspired by Justin Ingebretson and Trey Howell, JAMF Software 57 | # - Created by Douglas Worley Senior PSE, JAMF Software on June 1, 2016 58 | # 59 | #################################################################################################### 60 | 61 | 62 | # Enter full URL and credentials to the JSS 63 | apiUser="" 64 | apiPass="" 65 | # Enter numeric ID number of the EA 66 | # (You can discover this by reading a full Computer record in the API page) 67 | eaID="" 68 | # Enter the exact Display Name of the Extension Attribute (must be exactly how is in JSS) 69 | # (You can discover this by reading a full Computer record in the API page) 70 | eaName="" 71 | # JSS URL to PUT based on Serial Number. This could be "id" or "name" 72 | jssUrl="" 73 | # CSV File to that contains serials and EA values 74 | inputFile="" 75 | # Temporary XML file to be used 76 | tmpXmlFile="/tmp/tmp.xml" 77 | 78 | # #################################################################################################### 79 | # 80 | # CODE BELOW SHOULD NOT BE MODIFIED 81 | # 82 | #################################################################################################### 83 | 84 | 85 | echo "JAMF Software - Professional Services" 86 | echo "Mass Update - Computer Extension Attributes" && echo "" 87 | 88 | # Prompt operator to enter the required values, if they are not hard coded above 89 | if [[ $apiUser == "" ]] 90 | then 91 | echo "Enter API user account:" 92 | echo " example: jssadmin" 93 | read apiUser 94 | fi 95 | echo "" 96 | 97 | if [[ $apiPass == "" ]] 98 | then 99 | echo "Enter API user account:" 100 | echo " (silent input)" 101 | read -s apiPass 102 | fi 103 | echo "" 104 | 105 | if [[ $eaID == "" ]] 106 | then 107 | echo "Enter numeric ID for the Extension Attribute:" 108 | echo " example: 3" 109 | read eaID 110 | fi 111 | echo "" 112 | 113 | if [[ $eaName == "" ]] 114 | then 115 | echo "Enter name for the Extension Attribute:" 116 | echo " example: Status" 117 | read eaName 118 | fi 119 | echo "" 120 | 121 | if [[ $jssUrl == "" ]] 122 | then 123 | echo "Enter full JSS URL, without trailing slash:" 124 | echo " example: https://jss.company.com:8443" 125 | read jssUrl 126 | fi 127 | echo "" 128 | 129 | if [[ $inputFile == "" ]] 130 | then 131 | echo "Enter path to CSV file:" 132 | echo " example: /Users/admin/Desktop/examplecsv.csv" 133 | echo " (you can drag the file into the shell)" 134 | read inputFile 135 | fi 136 | echo "" 137 | 138 | echo "***** Running the script - this could take some time. See you in a moment... *****" 139 | ##Count the number of lines in the file so we know how many clients to submit## 140 | count=`cat "${inputFile}" | awk 'END{print NR}'` 141 | 142 | ##Set a variable to being counting the .csv line to be submitted## 143 | index="0" 144 | 145 | ##Loop through the .csv and submit the unique barcodes and unique asset tags based on## 146 | ##the client's unique mac address to the JSS until we've reached the end of the .csv## 147 | while [ $index -lt ${count} ] 148 | do 149 | touch $tmpXmlFile 150 | ##Increment our counter by 1 for each iteration## 151 | index=$[$index+1] 152 | 153 | ##Set unique variables to read the next line in the .csv## 154 | serialNumber=`cat "${inputFile}" | awk -F, 'FNR == '$[$index]' {print $1}'` 155 | eaValue=`cat "${inputFile}" | awk -F, 'FNR == '$[$index]' {print $2}'` 156 | 157 | echo "" 158 | echo "" 159 | echo "Current iteration through file: $index" 160 | echo "Serial Number is: $serialNumber" 161 | echo "EA Value is: $eaValue" 162 | fullApiPath="$jssUrl/JSSResource/computers/serialnumber/$serialNumber" 163 | echo "Full API Path is: $fullApiPath" 164 | echo "" 165 | 166 | # Create the temporary XML file with the data for each Computer 167 | cat < $tmpXmlFile 168 | 169 | 170 | 171 | 172 | $eaID 173 | $eaName 174 | String 175 | $eaValue 176 | 177 | 178 | 179 | EndXML 180 | 181 | # Error checking in stdout 182 | echo "XML file is:" 183 | cat "$tmpXmlFile" 184 | echo "" 185 | 186 | 187 | 188 | ##Submit the .csv data to the JSS via the JSS API## 189 | curl -k -v -u $apiUser:$apiPass $fullApiPath -T $tmpXmlFile -X PUT 190 | ##Clean up the temporary .xml file## 191 | rm $tmpXmlFile 192 | done 193 | echo "" 194 | echo "***** Done updating Computer Extension Attributes *****" 195 | echo "***** Please check and verify in the JSS: $jssUrl *****" 196 | echo "" 197 | 198 | 199 | 200 | exit $? 201 | -------------------------------------------------------------------------------- /Reporting Scripts/objects_scoped_to_AllComputers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # v1 3 | # set -x 4 | reset 5 | #################################################################################################### 6 | # 7 | # Copyright (c) 2015, JAMF Software, LLC. All rights reserved. 8 | # 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions are met: 11 | # * Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # * Redistributions in binary form must reproduce the above copyright 14 | # notice, this list of conditions and the following disclaimer in the 15 | # documentation and/or other materials provided with the distribution. 16 | # * Neither the name of the JAMF Software, LLC nor the 17 | # names of its contributors may be used to endorse or promote products 18 | # derived from this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 21 | # EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 24 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | #################################################################################################### 32 | 33 | ########## Description ########## 34 | ## 35 | # 36 | # This script is to query via the API any management objects that are scoped to "All Computers" 37 | # It does not look into any Limitations or Exclusions. 38 | # 39 | # Currently tested objects can be Policies, macOS Profiles, Restricted Software, Mac App Store Apps. 40 | # As of July 27 2017 there is a problem getting ID lists from osxconfigurationprofiles and restrictedsoftware, so this feature is disabled 41 | # policies and macapplications work fine 42 | # 43 | # The script derives the current user's Desktop, and creates a folder called "apiScript", 44 | # within there is a CSV file containing the output, and a "Scratch" folder with output of the XML 45 | # of the computer record. 46 | # 47 | ## 48 | ########## End Description ########## 49 | 50 | 51 | ########## Usage ########## 52 | ## 53 | # 54 | # This script has three options for providing the required variables: 55 | # 1: Pass the variables in as shell parameters in line 56 | # 2: Be prompted for the variables during shell execution 57 | # 3: Hard code variables into this script file 58 | # 59 | # 60 | # How To Use: 61 | # 1) To pass the variables in with script parameters in one line, keep the variables below blank. 62 | # Then, provide the path to the script with the URL, user & resource in one line separated by spaces. 63 | # Example: 64 | # ./jssApiObjectReport.sh https://jamf.company.com:8443 ladmin scripts 65 | # For security reasons, the password will need to be provided separately. 66 | # 67 | # 2) To be prompted for the variables, just run the unmodified script by itself and the shell will do the rest. 68 | # 69 | # 3) To hard code variables you can fill them in under the Customization section. 70 | # This option is not recommended. 71 | # 72 | ## 73 | ########## End Usage ########## 74 | 75 | 76 | 77 | ### If the values are left blank here, they will be prompted for during execution, or can be passed in as parameters. 78 | ### This option is not recommended. See Usage above. 79 | # JSS URL 80 | jssUrl="" 81 | # Full URL and credentials to the JSS. 82 | apiUser="" 83 | apiPass="" 84 | # Resource - needs to match how JSS spells the resource. 85 | apiResource="" 86 | ## 87 | ########## End Customization ########## 88 | 89 | 90 | 91 | ########## BODY OF SCRIPT - DO NOT MODIFY BELOW ########## 92 | ## 93 | 94 | CurrentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }') 95 | CurrentUserHome=$(dscl . -read /Users/$CurrentUser NFSHomeDirectory 2>/dev/null | awk '{ print $2 }') 96 | echo "" 97 | 98 | # read parameters 99 | if [[ $jssUrl == "" ]]; then 100 | jssUrl=$1 101 | fi 102 | if [[ $apiUser == "" ]]; then 103 | apiUser=$2 104 | fi 105 | if [[ $apiResource == "" ]]; then 106 | apiResource=$3 107 | fi 108 | 109 | 110 | if [[ $jssUrl == "" ]]; then 111 | echo "Enter your full Jamf Pro Server address:" 112 | echo " Example: https://jamf.company.com:8443" 113 | echo " Example: https://company.jamfcloud.com" 114 | read jssUrl 115 | fi 116 | 117 | if [[ $apiUser == "" ]]; then 118 | echo "Enter valid API username:" 119 | read apiUser 120 | fi 121 | 122 | if [[ $apiPass == "" ]]; then 123 | echo "" 124 | echo "Enter valid API user password:" 125 | echo "(silent input)" 126 | read -s apiPass 127 | fi 128 | if [[ $apiResource == "" ]]; then 129 | echo "What API resource do you want to report on?" 130 | echo "Example:" 131 | echo " macapplications" 132 | echo " osxconfigurationprofiles" 133 | echo " policies" 134 | echo " restrictedsoftware" 135 | read apiResource 136 | fi 137 | echo "" 138 | 139 | 140 | theDATE=$(date "+%Y_%m_%d") 141 | theTIME=$(date "+%H_%M") 142 | echo "The Date is: $theDATE" 143 | echo "The Time is: $theTIME" 144 | echo "" 145 | echo "Working parameters:" 146 | echo " local user: $CurrentUser" 147 | echo " local user home: $CurrentUserHome" 148 | echo " JSS URL: $jssUrl" 149 | echo " API username: $apiUser" 150 | echo " JSS Object: $apiResource" 151 | echo "" 152 | echo "" 153 | echo "" 154 | # File paths - Please do not modify 155 | folderPath="$CurrentUserHome/Desktop/apiScript" 156 | scratchFolderPath="$folderPath/Scratch" 157 | file1="$folderPath/peripheralName.xml" # File used to create computer name variables 158 | csvFile="$folderPath/Report_${apiResource}_Scoped_To_All_Computers--${theDATE}--${theTIME}.csv" # CSV file used as our counter and computer name variable for our CURL loop 159 | xmlPath="$folderPath/apiGET.xml" # File path to write our API GET. This will be the computer information by ID 160 | file2="$folderPath/report.txt" # Path to our final report. Use txt as the file format please 161 | 162 | rm -rf $scratchFolderPath 163 | if [ ! -e "$scratchFolderPath" ]; then 164 | mkdir -p "$scratchFolderPath" # sleep 2 165 | fi 166 | 167 | ### This is the kicker here. Generates a space separated array of every Peripheral ID to be queried. Thanks to Chris Shasse on the proper formatting. 168 | apiResourceIdList=$(/usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/$apiResource | tidy -xml 2>/dev/null | grep '' | sed -n 's|\(.*\)|\1|p' | sort -n) 169 | # echo "apiResourceIdList is: $apiResourceIdList" 170 | 171 | # How to parse data from API output (XML) 172 | # https://jamfsoftware.atlassian.net/wiki/display/SW/Pasing+XML+Data+from+the+API 173 | 174 | ### 175 | # Each variable to be generated into the csv will have an initial value so the first dump generates the csv headers on row 1. Each variable will be cleared and regenerated below. 176 | valueApiResourceID="$apiResource ID" 177 | valueApiResourceName="Name" 178 | valueApiResourceScopedAll="Scoped To All" 179 | 180 | ########### HERE THERE BE FUNCTIONS ########### 181 | 182 | function CsvDump { 183 | csvDumpContent="${valueApiResourceID}, ${valueApiResourceName}, ${valueApiResourceScopedAll}" 184 | # echo $csvDumpContent 185 | echo $csvDumpContent>>$csvFile 186 | } 187 | CsvDump # Put in the column headers 188 | 189 | 190 | ######### 191 | 192 | function ApiResourceLoop { 193 | # sleep 2 194 | echo " Working with File ID: $id " 195 | 196 | tempFile="$folderPath/Scratch/file$id.xml" 197 | # echo "tempFile is \"$tempFile\"" 198 | 199 | # /usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/$apiResource/id/$id/subset/general%26scope | xmllint --format - --xpath /name > $tempFile 200 | /usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/$apiResource/id/$id | xmllint --format - --xpath /name > $tempFile 201 | 202 | # cat $tempFile 203 | 204 | # Each variable to be generated into the CSV file will be cleared and then re-populated by parsing the $tempFile. This ensures that the CSV headers are populated only once, as well as the row in the CSV for each $id has unique/new data. 205 | # 2>&1 206 | 207 | valueApiResourceName="" 208 | valueApiResourceName=$(cat $tempFile | xpath //general/name 2>/dev/null | sed -e 's/\//g; s/\<\/name>//g') 209 | echo " valueApiResourceName is \"$valueApiResourceName\"" 210 | 211 | valueApiResourceID="" 212 | ## Even though the ID is read from the array, I'm checking the local cache file to verify that all of the data is consistent. 213 | valueApiResourceID=$(cat $tempFile | xpath //general/id 2>/dev/null | sed -e 's/\//g; s/\<\/id>//g') 214 | echo " valueApiResourceID is \"$valueApiResourceID\"" 215 | 216 | valueApiResourceScopedAll="" 217 | valueApiResourceScopedAll=$(cat $tempFile | xpath //all_computers 2>/dev/null | sed -e 's/\//g; s/\<\/all_computers>//g') 218 | echo " valueApiResourceScopedAll is \"$valueApiResourceScopedAll\"" 219 | 220 | # within one function, call another function to output the data into the CSV file 221 | if [[ "$valueApiResourceScopedAll" == "true" && "$valueApiResourceName" != 201* ]]; then 222 | CsvDump 223 | fi 224 | 225 | # rm $tempFile 226 | } 227 | 228 | function EchoLoop { 229 | # This is for testing that the array is being read in the proper order. 230 | echo $id 231 | } 232 | 233 | ######### Run the actual program ######### 234 | 235 | for id in ${apiResourceIdList}; do 236 | # EchoLoop 237 | ApiResourceLoop 238 | done 239 | 240 | # cp $csvFile $csvFileExport 241 | # open -a /Applications/Microsoft\ Excel.app $csvFileExport 242 | # 243 | 244 | # qlmanage -R "$csvFile" 245 | 246 | echo "Done! 247 | Please check out the report file located at: 248 | $csvFile" -------------------------------------------------------------------------------- /Reporting Scripts/objects_scoped_to_named_computer_group.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # v0 - in progress 3 | # set -x 4 | reset 5 | #################################################################################################### 6 | # 7 | # Copyright (c) 2015, JAMF Software, LLC. All rights reserved. 8 | # 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions are met: 11 | # * Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # * Redistributions in binary form must reproduce the above copyright 14 | # notice, this list of conditions and the following disclaimer in the 15 | # documentation and/or other materials provided with the distribution. 16 | # * Neither the name of the JAMF Software, LLC nor the 17 | # names of its contributors may be used to endorse or promote products 18 | # derived from this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 21 | # EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 24 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | #################################################################################################### 32 | 33 | ########## Description ########## 34 | ## 35 | # 36 | 37 | ## 38 | ########## End Description ########## 39 | 40 | 41 | ########## Usage ########## 42 | ## 43 | # 44 | # This script has three options for providing the required variables: 45 | # 1: Pass the variables in as shell parameters in line. (This requires quotes) 46 | # 2: Be prompted for the variables during shell execution (Do not include quotes) 47 | # 3: Hard code variables into this script file 48 | # 49 | # 50 | # How To Use: 51 | # 1) To pass the variables in with script parameters in one line, keep the variables below blank. 52 | # Then, provide the path to the script with the URL, user & resource in one line separated by spaces. If the Group contains spaces, please include the whole group in quotes. 53 | # Example: 54 | # ./objects_scoped_to_named_computer_group.sh https://jamf.company.com:8443 ladmin policies "All Managed Clients" 55 | # For security reasons, the password will need to be provided separately. 56 | # 57 | # 2) To be prompted for the variables, just run the unmodified script by itself and the shell will do the rest. 58 | # 59 | # 3) To hard code variables you can fill them in under the Customization section. 60 | # This option is not recommended. 61 | # 62 | ## 63 | ########## End Usage ########## 64 | 65 | 66 | 67 | ### If the values are left blank here, they will be prompted for during execution, or can be passed in as parameters. 68 | ### This option is not recommended. See Usage above. 69 | # JSS URL 70 | jssUrl="" 71 | # Full URL and credentials to the JSS. 72 | apiUser="" 73 | apiPass="" 74 | # Resource - needs to match how JSS spells the resource. 75 | apiResource="" 76 | # Computer Group - What we are reporting on. These groups should not have commas in the name. 77 | apiComputerGroup="" 78 | ## 79 | ########## End Customization ########## 80 | 81 | 82 | 83 | ########## BODY OF SCRIPT - DO NOT MODIFY BELOW ########## 84 | ## 85 | 86 | CurrentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }') 87 | CurrentUserHome=$(dscl . -read /Users/$CurrentUser NFSHomeDirectory 2>/dev/null | awk '{ print $2 }') 88 | echo "" 89 | 90 | # read parameters 91 | if [[ $jssUrl == "" ]]; then 92 | jssUrl=$1 93 | fi 94 | if [[ $apiUser == "" ]]; then 95 | apiUser=$2 96 | fi 97 | if [[ $apiResource == "" ]]; then 98 | apiResource=$3 99 | fi 100 | if [[ $apiComputerGroup == "" ]]; then 101 | apiComputerGroup=$4 102 | fi 103 | 104 | 105 | if [[ $jssUrl == "" ]]; then 106 | echo "Enter your full Jamf Pro Server address:" 107 | echo " Example: https://jamf.company.com:8443" 108 | echo " Example: https://company.jamfcloud.com" 109 | read jssUrl 110 | fi 111 | 112 | if [[ $apiUser == "" ]]; then 113 | echo "Enter valid API username:" 114 | read apiUser 115 | fi 116 | 117 | if [[ $apiPass == "" ]]; then 118 | echo "" 119 | echo "Enter valid API user password:" 120 | echo "(silent input)" 121 | read -s apiPass 122 | fi 123 | if [[ $apiResource == "" ]]; then 124 | echo "What API resource do you want to report on?" 125 | echo "Example:" 126 | echo " macapplications" 127 | echo " osxconfigurationprofiles" 128 | echo " policies" 129 | echo " restrictedsoftware" 130 | read apiResource 131 | fi 132 | if [[ $apiComputerGroup == "" ]]; then 133 | echo "What JSS Computer Group do you want to report on?" 134 | echo " Note: This must be spelled exactly as it is in the JSS." 135 | echo " Note: Do not include quotes" 136 | echo " Example: All Managed Clients" 137 | read apiComputerGroup 138 | fi 139 | echo "" 140 | echo "" 141 | 142 | 143 | theDATE=$(date "+%Y_%m_%d") 144 | theTIME=$(date "+%H_%M") 145 | echo "The Date is: $theDATE" 146 | echo "The Time is: $theTIME" 147 | echo "" 148 | echo "Working parameters:" 149 | echo " local user: $CurrentUser" 150 | echo " local user home: $CurrentUserHome" 151 | echo " JSS URL: $jssUrl" 152 | echo " API username: $apiUser" 153 | echo " JSS Object: $apiResource" 154 | echo " JSS Computer Group: $apiComputerGroup" 155 | echo "" 156 | echo "" 157 | echo "" 158 | # File paths - Please do not modify 159 | folderPath="$CurrentUserHome/Desktop/apiScript" 160 | scratchFolderPath="$folderPath/Scratch" 161 | file1="$folderPath/peripheralName.xml" # File used to create computer name variables 162 | csvFile="$folderPath/Report_${apiResource}_Scoped_To_Computer_Group_${apiComputerGroup}--${theDATE}--${theTIME}.csv" # CSV file used as our counter and computer name variable for our CURL loop 163 | xmlPath="$folderPath/apiGET.xml" # File path to write our API GET. This will be the computer information by ID 164 | file2="$folderPath/report.txt" # Path to our final report. Use txt as the file format please 165 | 166 | rm -rf $scratchFolderPath 167 | if [ ! -e "$scratchFolderPath" ]; then 168 | mkdir -p "$scratchFolderPath" # sleep 2 169 | fi 170 | 171 | ### This is the kicker here. Generates a space separated array of every Peripheral ID to be queried. Thanks to Chris Shasse on the proper formatting. 172 | apiResourceIdList=$(/usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/$apiResource | tidy -xml 2>/dev/null | grep '' | sed -n 's|\(.*\)|\1|p' | sort -n) 173 | # echo "apiResourceIdList is: $apiResourceIdList" 174 | 175 | # How to parse data from API output (XML) 176 | # https://jamfsoftware.atlassian.net/wiki/display/SW/Pasing+XML+Data+from+the+API 177 | 178 | ### 179 | # Each variable to be generated into the csv will have an initial value so the first dump generates the csv headers on row 1. Each variable will be cleared and regenerated below. 180 | valueApiResourceID="$apiResource ID" 181 | valueApiResourceName="Name" 182 | valueApiResourceScopedToGroup="Scoped To $apiComputerGroup" 183 | 184 | ########### HERE THERE BE FUNCTIONS ########### 185 | 186 | function CsvDump { 187 | csvDumpContent="${valueApiResourceID}, ${valueApiResourceName}, ${valueApiResourceScopedToGroup}" 188 | # echo $csvDumpContent 189 | echo $csvDumpContent>>$csvFile 190 | } 191 | CsvDump # Put in the column headers 192 | 193 | 194 | ######### 195 | 196 | function ApiResourceLoop { 197 | # sleep 2 198 | echo " Working with File ID: $id " 199 | 200 | tempFile="$folderPath/Scratch/file$id.xml" 201 | # echo "tempFile is \"$tempFile\"" 202 | 203 | # /usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/$apiResource/id/$id/subset/general%26scope | xmllint --format - --xpath /name > $tempFile 204 | /usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/$apiResource/id/$id | xmllint --format - --xpath /name > $tempFile 205 | 206 | # cat $tempFile 207 | 208 | # Each variable to be generated into the CSV file will be cleared and then re-populated by parsing the $tempFile. This ensures that the CSV headers are populated only once, as well as the row in the CSV for each $id has unique/new data. 209 | # 2>&1 210 | 211 | valueApiResourceName="" 212 | valueApiResourceName=$(cat $tempFile | xpath //general/name 2>/dev/null | sed -e 's/\//g; s/\<\/name>//g') 213 | echo " valueApiResourceName is \"$valueApiResourceName\"" 214 | 215 | valueApiResourceID="" 216 | ## Even though the ID is read from the array, I'm checking the local cache file to verify that all of the data is consistent. 217 | valueApiResourceID=$(cat $tempFile | xpath //general/id 2>/dev/null | sed -e 's/\//g; s/\<\/id>//g') 218 | echo " valueApiResourceID is \"$valueApiResourceID\"" 219 | 220 | valueApiResourceScopedToGroup="" 221 | valueApiResourceScopedToGroup=$(cat $tempFile | xpath //scope/computer_groups/computer_group/name 2>/dev/null | sed -e 's/\//g; s/\<\/name>//g') 222 | echo " valueApiResourceScopedToGroup is \"$valueApiResourceScopedToGroup\"" 223 | 224 | # within one function, call another function to output the data into the CSV file 225 | if [[ "$valueApiResourceScopedToGroup" == *$apiComputerGroup* ]]; then 226 | echo "  valueApiResourceScopedToGroup MATCHES apiComputerGroup = writing $apiComputerGroup to file " 227 | CsvDump 228 | else 229 | echo "  valueApiResourceScopedToGroup DOES NOT match apiComputerGroup " 230 | echo "  $valueApiResourceScopedToGroup != $apiComputerGroup " 231 | fi 232 | 233 | # rm $tempFile 234 | } 235 | 236 | function EchoLoop { 237 | # This is for testing that the array is being read in the proper order. 238 | echo $id 239 | } 240 | 241 | ######### Run the actual program ######### 242 | 243 | for id in ${apiResourceIdList}; do 244 | # EchoLoop 245 | ApiResourceLoop 246 | done 247 | 248 | # cp $csvFile $csvFileExport 249 | # open -a /Applications/Microsoft\ Excel.app $csvFileExport 250 | # 251 | 252 | # qlmanage -R "$csvFile" 253 | 254 | echo "Done! 255 | Please check out the report file located at: 256 | $csvFile" -------------------------------------------------------------------------------- /Reporting Scripts/object_utilization_by_group.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # v0.5 - in progress 3 | # set -x 4 | reset 5 | #################################################################################################### 6 | # 7 | # Copyright (c) 2015, JAMF Software, LLC. All rights reserved. 8 | # 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions are met: 11 | # * Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # * Redistributions in binary form must reproduce the above copyright 14 | # notice, this list of conditions and the following disclaimer in the 15 | # documentation and/or other materials provided with the distribution. 16 | # * Neither the name of the JAMF Software, LLC nor the 17 | # names of its contributors may be used to endorse or promote products 18 | # derived from this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 21 | # EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 24 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | #################################################################################################### 32 | 33 | ########## Description ########## 34 | ## 35 | # 36 | 37 | ## 38 | ########## End Description ########## 39 | 40 | 41 | ########## Usage ########## 42 | ## 43 | # 44 | # This script has three options for providing the required variables: 45 | # 1: Pass the variables in as shell parameters in line. (This requires quotes) 46 | # 2: Be prompted for the variables during shell execution (Do not include quotes) 47 | # 3: Hard code variables into this script file 48 | # 49 | # 50 | # How To Use: 51 | # 1) To pass the variables in with script parameters in one line, keep the variables below blank. 52 | # Then, provide the path to the script with the URL, user & resource in one line separated by spaces. 53 | # If the Group contains spaces, please include the whole group in quotes. 54 | # Example: 55 | # ./object_utilization_by_group.sh https://jamf.company.com:8443 ladmin "All Managed Clients" 56 | # For security reasons, the password will need to be provided separately. 57 | # 58 | # 2) To be prompted for the variables, just run the unmodified script by itself and the shell will do the rest. 59 | # 60 | # 3) To hard code variables you can fill them in under the Customization section. 61 | # This option is not recommended. 62 | # 63 | ## 64 | ########## End Usage ########## 65 | 66 | 67 | ### If the values are left blank here, they will be prompted for during execution, or can be passed in as parameters. 68 | ### This option is not recommended. See Usage above. 69 | # JSS URL 70 | jssUrl="" 71 | # Full URL and credentials to the JSS. 72 | apiUser="" 73 | apiPass="" 74 | # Computer Group - What we are reporting on. These groups should not have commas in the name. 75 | apiComputerGroup="" 76 | ## 77 | ########## End Customization ########## 78 | 79 | 80 | 81 | ########## BODY OF SCRIPT - DO NOT MODIFY BELOW ########## 82 | ## 83 | 84 | CurrentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }') 85 | CurrentUserHome=$(dscl . -read /Users/$CurrentUser NFSHomeDirectory 2>/dev/null | awk '{ print $2 }') 86 | echo "" 87 | 88 | # read parameters 89 | if [[ $jssUrl == "" ]]; then 90 | jssUrl=$1 91 | fi 92 | if [[ $apiUser == "" ]]; then 93 | apiUser=$2 94 | fi 95 | if [[ $apiComputerGroup == "" ]]; then 96 | apiComputerGroup=$3 97 | fi 98 | 99 | 100 | if [[ $jssUrl == "" ]]; then 101 | echo "Enter your full Jamf Pro Server address:" 102 | echo " Example: https://jamf.company.com:8443" 103 | echo " Example: https://company.jamfcloud.com" 104 | read jssUrl 105 | fi 106 | 107 | if [[ $apiUser == "" ]]; then 108 | echo "Enter valid API username:" 109 | read apiUser 110 | fi 111 | 112 | if [[ $apiPass == "" ]]; then 113 | echo "" 114 | echo "Enter valid API user password:" 115 | echo "(silent input)" 116 | read -s apiPass 117 | fi 118 | if [[ $apiComputerGroup == "" ]]; then 119 | echo "What JSS Computer Group do you want to report on?" 120 | echo " Note: This must be spelled exactly as it is in the JSS." 121 | echo " Note: Do not include quotes" 122 | echo " Example: All Managed Clients" 123 | read apiComputerGroup 124 | fi 125 | echo "" 126 | echo "" 127 | 128 | 129 | theDATE=$(date "+%Y_%m_%d") 130 | theTIME=$(date "+%H_%M") 131 | echo "The Date is: $theDATE" 132 | echo "The Time is: $theTIME" 133 | echo "" 134 | echo "Working parameters:" 135 | echo " local user: $CurrentUser" 136 | echo " local user home: $CurrentUserHome" 137 | echo " JSS URL: $jssUrl" 138 | echo " API username: $apiUser" 139 | echo " JSS Computer Group: \"$apiComputerGroup\"" 140 | echo "" 141 | echo "" 142 | echo "" 143 | # File paths - Please do not modify 144 | folderPath="$CurrentUserHome/Desktop/apiScript" 145 | scratchFolderPath="$folderPath/Scratch" 146 | file1="$folderPath/peripheralName.xml" # File used to create computer name variables 147 | csvFile="$folderPath/Report_Utilization_of_Computer_Group_${apiComputerGroup}--${theDATE}--${theTIME}.csv" # CSV file used as our counter and computer name variable for our CURL loop 148 | xmlPath="$folderPath/apiGET.xml" # File path to write our API GET. This will be the computer information by ID 149 | file2="$folderPath/report.txt" # Path to our final report. Use txt as the file format please 150 | 151 | rm -rf $scratchFolderPath 152 | if [ ! -e "$scratchFolderPath" ]; then 153 | mkdir -p "$scratchFolderPath" # sleep 2 154 | fi 155 | 156 | ### This is the kicker here. Generates a space separated array of every requirex ID type to be queried. Thanks to Chris Shasse on the proper formatting. 157 | 158 | 159 | policyIdList=$(/usr/bin/curl -sk $jssUrl/JSSResource/policies --user "$apiUser:$apiPass" -H 'Accept: application/xml' -X GET | xpath "//policy[not(contains(name,'|'))]" 2>/dev/null | tidy -xml 2>/dev/null | grep '' | sed -n 's|\(.*\)|\1|p' | sort -n) 160 | # echo "policyIdList is: $policyIdList" 161 | 162 | macapplicationsIdList=$(/usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/macapplications | tidy -xml 2>/dev/null | grep '' | sed -n 's|\(.*\)|\1|p' | sort -n) 163 | # echo "macapplicationsIdList is: $macapplicationsIdList" 164 | 165 | osxconfigurationprofilesIdList=$(/usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/osxconfigurationprofiles | tidy -xml 2>/dev/null | grep '' | sed -n 's|\(.*\)|\1|p' | sort -n) 166 | # echo "osxconfigurationprofilesIdList is: $osxconfigurationprofilesIdList" 167 | 168 | restrictedsoftwareIdList=$(/usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/restrictedsoftware | tidy -xml 2>/dev/null | grep '' | sed -n 's|\(.*\)|\1|p' | sort -n) 169 | # echo "osxconfigurationprofilesIdList is: $osxconfigurationprofilesIdList" 170 | 171 | 172 | 173 | # How to parse data from API output (XML) 174 | # https://jamfsoftware.atlassian.net/wiki/display/SW/Pasing+XML+Data+from+the+API 175 | 176 | ### 177 | # Each variable to be generated into the csv will have an initial value so the first dump generates the csv headers on row 1. Each variable will be cleared and regenerated below. 178 | valueGroupName="Group Name" 179 | valueGroupID="Group ID" 180 | valuePoliciesScopedToGroup="Policies" 181 | valueMacProfilesScopedToGroup="macOS Profiles" 182 | valueRestrictedSoftwareScopedToGroup="Restricted Software" 183 | valueMacAppStoreAppScopedToGroup="Mac App Store" 184 | 185 | 186 | ########### HERE THERE BE FUNCTIONS ########### 187 | 188 | function CsvDump { 189 | csvDumpContent="${valueGroupName}, ${valueGroupID}, ${valuePoliciesScopedToGroup}, ${valueMacProfilesScopedToGroup}, ${valueRestrictedSoftwareScopedToGroup}, ${valueMacAppStoreAppScopedToGroup}" 190 | # echo $csvDumpContent 191 | echo $csvDumpContent>>$csvFile 192 | } 193 | CsvDump # Put in the column headers 194 | 195 | 196 | 197 | 198 | 199 | function PolicyAttribution { 200 | echo "" 201 | echo "# macOS Policies #" 202 | for policyId in ${policyIdList}; do 203 | tempFile="$folderPath/Scratch/policy_$policyId.xml" 204 | /usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/policies/id/$policyId | xmllint --format - --xpath /name 2>/dev/null > $tempFile 205 | policiesScopedToGroup=$(cat $tempFile | xpath //scope/computer_groups/computer_group/name 2>/dev/null) 206 | if [[ $(echo $policiesScopedToGroup | grep "$apiComputerGroup") != "" ]]; then 207 | policyName=$(cat $tempFile | xpath //policy/general/name 2>/dev/null | sed -e 's/\//g; s/\<\/name>//g') 208 | echo "  Policy ID: $policyId - \"$policyName\" - Scope CONTAINS \"$apiComputerGroup\" " 209 | valuePoliciesScopedToGroup=$(expr $valuePoliciesScopedToGroup + 1) 210 | echo " macOS Policy count is now: $valuePoliciesScopedToGroup" 211 | fi 212 | done 213 | } 214 | 215 | 216 | function MacProfileAttribution { 217 | echo "" 218 | echo "# macOS Profiles #" 219 | for macProfileId in ${osxconfigurationprofilesIdList}; do 220 | tempFile="$folderPath/Scratch/macProfile_$macProfileId.xml" 221 | /usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/osxconfigurationprofiles/id/$macProfileId | xmllint --format - --xpath /name 2>/dev/null > $tempFile 222 | macProfileScopedToGroup=$(cat $tempFile | xpath //scope/computer_groups/computer_group/name 2>/dev/null) 223 | if [[ $(echo $macProfileScopedToGroup | grep "$apiComputerGroup") != "" ]]; then 224 | macProfileName=$(cat $tempFile | xpath //os_x_configuration_profile/general/name 2>/dev/null | sed -e 's/\//g; s/\<\/name>//g') 225 | echo "  macOS Profile ID: $macProfileId - \"$macProfileName\" - Scope CONTAINS \"$apiComputerGroup\" " 226 | valueMacProfilesScopedToGroup=$(expr $valueMacProfilesScopedToGroup + 1) 227 | echo " macOS Profile count is now: $valueMacProfilesScopedToGroup" 228 | fi 229 | done 230 | } 231 | 232 | function MacRestrictedSoftwareAttribution { 233 | echo "" 234 | echo "# macOS Restricted Software #" 235 | for macRestrictedSoftwareId in ${restrictedsoftwareIdList}; do 236 | tempFile="$folderPath/Scratch/macRestrictedSoftware_$macRestrictedSoftwareId.xml" 237 | /usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/restrictedsoftware/id/$macRestrictedSoftwareId | xmllint --format - --xpath /name 2>/dev/null > $tempFile 238 | macRestrictedSoftwareScopedToGroup=$(cat $tempFile | xpath //scope/computer_groups/computer_group/name 2>/dev/null) 239 | if [[ $(echo $macRestrictedSoftwareScopedToGroup | grep "$apiComputerGroup") != "" ]]; then 240 | macRestrictedSoftwareName=$(cat $tempFile | xpath //mac_application/general/name 2>/dev/null | sed -e 's/\//g; s/\<\/name>//g') 241 | echo "  macOS Profile ID: $macRestrictedSoftwareId - \"macRestrictedSoftwareName\" - Scope CONTAINS \"$apiComputerGroup\" " 242 | valueRestrictedSoftwareScopedToGroup=$(expr $valueRestrictedSoftwareScopedToGroup + 1) 243 | echo " macOS Profile count is now: $valueRestrictedSoftwareScopedToGroup" 244 | fi 245 | done 246 | } 247 | 248 | function MacAppStoreAppAttribution { 249 | echo "" 250 | echo "# macOS App Store Apps #" 251 | for macAppStoreAppId in ${macapplicationsIdList}; do 252 | tempFile="$folderPath/Scratch/macAppStoreApp_$macAppStoreAppId.xml" 253 | /usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/macapplications/id/$macAppStoreAppId | xmllint --format - --xpath /name 2>/dev/null > $tempFile 254 | macAppStoreAppScopedToGroup=$(cat $tempFile | xpath //scope/computer_groups/computer_group/name 2>/dev/null) 255 | if [[ $(echo $macRestrictedSoftwareScopedToGroup | grep "$apiComputerGroup") != "" ]]; then 256 | macAppStoreAppName=$(cat $tempFile | xpath //mac_application/general/name 2>/dev/null | sed -e 's/\//g; s/\<\/name>//g') 257 | echo "  macOS App Store App ID: $macAppStoreAppId - \"$macAppStoreAppName\" - Scope CONTAINS \"$apiComputerGroup\" " 258 | valueMacAppStoreAppScopedToGroup=$(expr $valueMacAppStoreAppScopedToGroup + 1) 259 | echo " Mac App Store count is now: $valueMacAppStoreAppScopedToGroup" 260 | fi 261 | done 262 | } 263 | 264 | ########## 265 | ######### Run the actual program ######### 266 | # Reset the variables 267 | echo "" 268 | echo "Running the functions for group: $apiComputerGroup" 269 | echo "... This may take a while ..." 270 | valueGroupID=$(/usr/bin/curl -sk -u $apiUser:$apiPass -H "Accept: application/xml" $jssUrl/JSSResource/computergroups/name/ExcludeMe | xpath //computer_group/id 2>/dev/null | sed -e 's/\//g; s/\<\/id>//g') 271 | valueGroupName="$apiComputerGroup" 272 | valuePoliciesScopedToGroup="0" 273 | valueMacProfilesScopedToGroup="0" 274 | valueRestrictedSoftwareScopedToGroup="0" 275 | valueMacAppStoreAppScopedToGroup="0" 276 | 277 | # Run the functions 278 | PolicyAttribution 279 | MacProfileAttribution 280 | MacRestrictedSoftwareAttribution 281 | MacAppStoreAppAttribution 282 | CsvDump 283 | 284 | echo "Done! 285 | Please check out the report file located at: 286 | $csvFile" 287 | -------------------------------------------------------------------------------- /Manual Scripts/osxMinimalDiskShrinker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | clear 3 | 4 | #################################################################################################### 5 | # 6 | # Copyright (c) 2014, JAMF Software, LLC. All rights reserved. 7 | # 8 | # This script was written by the JAMF Software Profesional Services Team 9 | # 10 | # THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY 11 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 12 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 13 | # DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY 14 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 15 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 16 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 17 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 18 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 19 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 20 | # 21 | ##################################################################################################### 22 | # 23 | # SUPPORT FOR THIS PROGRAM 24 | # 25 | # This program is distributed "as is" by JAMF Software, Professional Services Team. For more 26 | # information or support for this script, please contact your JAMF Software Account Manager. 27 | # 28 | ##################################################################################################### 29 | # 30 | # ABOUT THIS PROGRAM 31 | # 32 | # NAME 33 | # osxMinimalDiskShrinker.sh 34 | # 35 | # SYNOPSIS - How to use 36 | # 37 | # Run this script locally in a shell with sudo privileges. Do not run this script as part of a JAMF policy. 38 | # 39 | # DESCRIPTION 40 | # 41 | # This script prompts the administrator to drag in a volume to thin out. 42 | # This script deletes resources from Mac OS X that are not required for a minimal system. 43 | # 44 | # Use this for shrinking a system for use with NetBooting, USB boot disk, etc. 45 | # Script prompts the administrator to drag in the icon of a mounted volume to shrink. 46 | # If the volume to be shrunk is a disk image, drag in the mounted volume - not the .dmg file. 47 | # 48 | # 49 | #################################################################################################### 50 | # 51 | # HISTORY 52 | # 53 | # Version: 1.0 54 | # - Created by Douglas Worley, Professional Services Engineer, JAMF Software on June 5, 2014 55 | # 56 | #################################################################################################### 57 | 58 | [ $EUID != 0 ] && echo "This script requires root privileges, please run \"sudo $0\"" && exit 1 59 | 60 | ScriptFileName=`basename $0` 61 | ScriptName=`basename $ScriptFileName .sh` 62 | 63 | # set -x # DEBUG. Display commands and their arguments as they are executed 64 | # set -v # VERBOSE. Display shell input lines as they are read. 65 | # set -n # EVALUATE. Check syntax of the script but dont execute 66 | 67 | ################### 68 | ### Setup - Variables 69 | DATE=$(date "+%Y_%m_%d") 70 | TIME=$(date "+%H:%M") 71 | 72 | logfilepath="/Library/MyLogs/" # make sure the / is at the beginning and end of this path 73 | if [ ! -d $logfilepath ]; then 74 | mkdir $logfilepath 75 | if [ "$?" = "0" ]; then 76 | echo "Creating directory $logfilepath" 77 | else 78 | echo "Error - could not create directory $logfilepath" 79 | fi 80 | fi 81 | 82 | logfile="${DATE}_${ScriptName}_${TIME}.txt" 83 | exec 2>&1 > >(tee $logfilepath$logfile) # Uncomment me for full shell output to custom log 84 | echo "" && echo "" 85 | echo "Script name: $ScriptName" && echo "" 86 | echo "Log file path: $logfilepath$logfile" 87 | echo "Date and Time: $DATE $TIME" 88 | 89 | ################### 90 | ### Begin the logic for this script 91 | 92 | echo "Drag in the volume to be shrunken:" 93 | echo " (this needs to be the volume, not the .dmg file)" 94 | read targetVolume 95 | echo "" 96 | cd "$targetVolume" 97 | echo "Target Volume is $targetVolume" 98 | echo "Calculating space used - before shrinking:" 99 | du -ch "$targetVolume" | grep total 100 | 101 | function deleteTheFile 102 | { 103 | while test $# -gt 0 104 | do 105 | # echo " deleting file: $targetVolume$1" 106 | rm -rf "$targetVolume$1" 107 | shift 108 | done 109 | } 110 | 111 | # Long string here of files to delete, to be read by the function above. 112 | # Do not include quotation marks in file paths. 113 | filesToDelete="/Applications/Address\ Book.app 114 | /Applications/Automator.app 115 | /Applications/Calculator.app 116 | /Applications/Calendar.app 117 | /Applications/Chess.app 118 | /Applications/Contacts.app 119 | /Applications/DVD\ Player.app 120 | /Applications/Dashboard.app 121 | /Applications/Dictionary.app 122 | /Applications/FaceTime.app 123 | /Applications/Font\ Book.app 124 | /Applications/Game\ Center.app 125 | /Applications/Image\ Capture.app 126 | /Applications/Launchpad.app 127 | /Applications/Mail.app 128 | /Applications/Maps.app 129 | /Applications/Mission\ Control.app 130 | /Applications/Notes.app 131 | /Applications/Photo\ Booth.app 132 | /Applications/QuickTime\ Player.app 133 | /Applications/Reminders.app 134 | /Applications/Stickies.app 135 | /Applications/Time\ Machine.app 136 | /Applications/Utilities/AirPort\ Utility.app 137 | /Applications/Utilities/AppleScript\ Editor.app 138 | /Applications/Utilities/Audio\ MIDI\ Setup.app 139 | /Applications/Utilities/Bluetooth\ File\ Exchange.app 140 | /Applications/Utilities/Boot\ Camp\ Assistant.app 141 | /Applications/Utilities/ColorSync\ Utility.app 142 | /Applications/Utilities/DigitalColor\ Meter.app 143 | /Applications/Utilities/Grab.app 144 | /Applications/Utilities/Grapher.app 145 | /Applications/Utilities/Migration\ Assistant.app 146 | /Applications/Utilities/Podcast\ Capture.app 147 | /Applications/Utilities/Podcast\ Publisher.app 148 | /Applications/Utilities/RAID\ Utility.app 149 | /Applications/Utilities/VoiceOver\ Utility.app 150 | /Applications/Utilities/X11.app 151 | /Applications/iBooks.app 152 | /Applications/iCal.app 153 | /Applications/iChat.app 154 | /Applications/iTunes.app 155 | /Library/Application\ Support/Apple/Automator 156 | /Library/Application\ Support/Apple/Fonts 157 | /Library/Application\ Support/Apple/Grapher 158 | /Library/Application\ Support/Apple/Mail 159 | /Library/Application\ Support/Apple/System\ Image\ Utility 160 | /Library/Application\ Support/Apple/WikiServer 161 | /Library/Application\ Support/Apple/iChat\ Icons 162 | /Library/Application\ Support/CrashReporter 163 | /Library/Application\ Support/CrashReporter/* 164 | /Library/Application\ Support/Macromedia 165 | /Library/Application\ Support/ProApps 166 | /Library/Application\ Support/iLifeMediaBrowser 167 | /Library/Audio/* 168 | /Library/Caches/* 169 | /Library/Desktop\ Pictures/* 170 | /Library/Desktop\ Pictures/.DS_Store 171 | /Library/Desktop\ Pictures/.thumbnails 172 | /Library/Desktop\ Pictures/Abstract 173 | /Library/Desktop\ Pictures/Aqua\ Blue.jpg 174 | /Library/Desktop\ Pictures/Aqua\ Graphite.jpg 175 | /Library/Desktop\ Pictures/Art 176 | /Library/Desktop\ Pictures/Black\ \&\ White 177 | /Library/Desktop\ Pictures/Classic\ Aqua\ Blue.jpg 178 | /Library/Desktop\ Pictures/Classic\ Aqua\ Graphite.jpg 179 | /Library/Desktop\ Pictures/Flow\ 1.jpg 180 | /Library/Desktop\ Pictures/Flow\ 2.jpg 181 | /Library/Desktop\ Pictures/Flow\ 3.jpg 182 | /Library/Desktop\ Pictures/Jaguar\ Aqua\ Blue.jpg 183 | /Library/Desktop\ Pictures/Jaguar\ Aqua\ Graphite.jpg 184 | /Library/Desktop\ Pictures/Lines\ Blue.jpg 185 | /Library/Desktop\ Pictures/Lines\ Graphite.jpg 186 | /Library/Desktop\ Pictures/Lines\ Moss.jpg 187 | /Library/Desktop\ Pictures/Lines\ Plum.jpg 188 | /Library/Desktop\ Pictures/Nature 189 | /Library/Desktop\ Pictures/Panther\ Aqua\ Blue.jpg 190 | /Library/Desktop\ Pictures/Panther\ Aqua\ Graphite.jpg 191 | /Library/Desktop\ Pictures/Patterns 192 | /Library/Desktop\ Pictures/Plants 193 | /Library/Desktop\ Pictures/Ripples\ Blue.jpg 194 | /Library/Desktop\ Pictures/Ripples\ Moss.jpg 195 | /Library/Desktop\ Pictures/Ripples\ Purple.jpg 196 | /Library/Desktop\ Pictures/Small\ Ripples.png 197 | /Library/Desktop\ Pictures/Small\ Ripples\ graphite.png 198 | /Library/Desktop\ Pictures/Solid\ Colors 199 | /Library/Desktop\ Pictures/Tiles\ Blue.jpg 200 | /Library/Desktop\ Pictures/Tiles\ Pine.jpg 201 | /Library/Desktop\ Pictures/Tiles\ Warm\ Grey.jpg 202 | /Library/Developer/* 203 | /Library/Dictionaries/* 204 | /Library/Documentation/* 205 | /Library/Fonts/* 206 | /Library/Image\ Capture/* 207 | /Library/Internet\ Plug-Ins/Flash\ Player.plugin 208 | /Library/Internet\ Plug-Ins/NP-PPC-Dir-Shockwave 209 | /Library/Internet\ Plug-Ins/flashplayer.xpt 210 | /Library/Logs 211 | /Library/Modem Scripts 212 | /Library/PDF Services 213 | /Library/Perl 214 | /Library/Printers/* 215 | /Library/QuickLook/iWork.qlgenerator 216 | /Library/Receipts/* 217 | /Library/Scripts 218 | /Library/Spotlight 219 | /Library/Updates/* 220 | /Library/User\ Pictures/Animals 221 | /Library/User\ Pictures/Flowers 222 | /Library/User\ Pictures/Fun 223 | /Library/User\ Pictures/Instruments 224 | /Library/User\ Pictures/Nature 225 | /Library/User\ Pictures/Sports/8ball.tif 226 | /Library/User\ Pictures/Sports/Baseball.tif 227 | /Library/User\ Pictures/Sports/Bowling.tif 228 | /Library/User\ Pictures/Sports/Football.tif 229 | /Library/User\ Pictures/Sports/Golf.tif 230 | /Library/User\ Pictures/Sports/Hockey.tif 231 | /Library/User\ Pictures/Sports/Soccer.tif 232 | /Library/User\ Pictures/Sports/Target.tif 233 | /Library/User\ Pictures/Sports/Tennis.tif 234 | /Library/WebServer/* 235 | /Library/Widgets/* 236 | /Library/iTunes 237 | /System/Library/Address\ Book\ Plug-Ins/* 238 | /System/Library/Automator/* 239 | /System/Library/Caches/* 240 | /System/Library/CoreServices/Setup\ Assistant.app/Contents/Resources/ TransitionSection.bundle/Contents/Resources/intro-sound.mp3 241 | /System/Library/CoreServices/Setup\ Assistant.app/Contents/Resources/ TransitionSection.bundle/Contents/Resources/intro.mov 242 | /System/Library/CoreServices/Encodings/* 243 | /System/Library/CoreServices/Front\ Row.app 244 | /System/Library/CoreServices/Menu\ Extras/ExpressCard.menu 245 | /System/Library/CoreServices/Menu\ Extras/Fax.menu 246 | /System/Library/CoreServices/Menu\ Extras/HomeSync.menu 247 | /System/Library/CoreServices/Menu\ Extras/Ink.menu 248 | /System/Library/CoreServices/Menu\ Extras/IrDA.menu 249 | /System/Library/CoreServices/Menu\ Extras/PPP.menu 250 | /System/Library/CoreServices/Menu\ Extras/PPPoE.menu 251 | /System/Library/CoreServices/Menu\ Extras/RemoteDesktop.menu 252 | /System/Library/CoreServices/Menu\ Extras/Script Menu.menu 253 | /System/Library/CoreServices/Menu\ Extras/Spaces.menu 254 | /System/Library/CoreServices/Menu\ Extras/Sync.menu 255 | /System/Library/CoreServices/Menu\ Extras/TextInput.menu 256 | /System/Library/CoreServices/Menu\ Extras/TimeMachine.menu 257 | /System/Library/CoreServices/Menu\ Extras/UniversalAccess.menu 258 | /System/Library/CoreServices/Menu\ Extras/VPN.menu 259 | /System/Library/CoreServices/Menu\ Extras/WWAN.menu 260 | /System/Library/CoreServices/Menu\ Extras/iChat.menu 261 | /System/Library/CoreServices/RawCamera.bundle 262 | /System/Library/Fonts/AppleGothic.ttf 263 | /System/Library/Fonts/AquaKana.ttc 264 | /System/Library/Fonts/Courier.dfont 265 | /System/Library/Fonts/LastResort.ttf 266 | /System/Library/Fonts/Menlo.ttc 267 | /System/Library/Fonts/STHeiti\ Light.ttc 268 | /System/Library/Fonts/儷黑\ Pro.ttf 269 | /System/Library/Fonts/华⽂文⿊黑体.ttf 270 | /System/Library/Fonts/华⽂文细⿊黑.ttf 271 | /System/Library/Fonts/ヒラギノ明朝\ ProN\ W3.otf 272 | /System/Library/Fonts/ヒラギノ角ゴ\ ProN\ W3.otf 273 | /System/Library/Fonts/ヒラギノ明朝\ ProN\ W6.otf 274 | /System/Library/Fonts/ヒラギノ角ゴ\ ProN\ W6.otf 275 | /System/Library/Frameworks/XgridFoundation.framework 276 | /System/Library/Input\ Methods/50onPaletteServer.app 277 | /System/Library/Input\ Methods/CharacterPalette.app 278 | /System/Library/Input\ Methods/ChineseHandwriting.app 279 | /System/Library/Input\ Methods/InkServer.app 280 | /System/Library/Input\ Methods/KoreanIM.app 281 | /System/Library/Input\ Methods/Kotoeri.app 282 | /System/Library/Input\ Methods/PluginIM.app 283 | /System/Library/Input\ Methods/SCIM.app 284 | /System/Library/Input\ Methods/TCIM.app 285 | /System/Library/Input\ Methods/TamilIM.app 286 | /System/Library/Input\ Methods/VietnameseIM.app 287 | /System/Library/PreferencePanes/Expose.prefPane 288 | /System/Library/PreferencePanes/FibreChannel.prefPane 289 | /System/Library/PreferencePanes/Ink.prefPane 290 | /System/Library/PreferencePanes/Mac.prefPane 291 | /System/Library/PreferencePanes/MobileMe.prefPane 292 | /System/Library/PreferencePanes/Mouse.prefPane/Contents/Resources/ touchMovie.mov 293 | /System/Library/PreferencePanes/SoftwareUpdate.prefPane 294 | /System/Library/PreferencePanes/Spotlight.prefPane 295 | /System/Library/PreferencePanes/TimeMachine.prefPane 296 | /System/Library/PreferencePanes/Trackpad.prefPane/Contents/Resources/ BTTrackpad.mov 297 | /System/Library/PreferencePanes/Trackpad.prefPane/Contents/Resources/ ButtonlessTrackpadCombo.mov 298 | /System/Library/PreferencePanes/Trackpad.prefPane/Contents/Resources/ TrackpadCombo.mov 299 | /System/Library/Screen\ Savers/Abstract.slideSaver 300 | /System/Library/Screen\ Savers/Arabesque.qtz 301 | /System/Library/Screen\ Savers/Beach.slideSaver 302 | /System/Library/Screen\ Savers/Cosmos.slideSaver 303 | /System/Library/Screen\ Savers/FloatingMessage.saver 304 | /System/Library/Screen\ Savers/Forest.slideSaver 305 | /System/Library/Screen\ Savers/Nature\ Patterns.slideSaver 306 | /System/Library/Screen\ Savers/Paper\ Shadow.slideSaver 307 | /System/Library/Screen\ Savers/RSS\ Visualizer.qtz 308 | /System/Library/Screen\ Savers/Random.saver 309 | /System/Library/Screen\ Savers/Shell.qtz 310 | /System/Library/Screen\ Savers/Spectrum.qtz 311 | /System/Library/Screen\ Savers/Word\ of\ the\ Day.qtz 312 | /System/Library/Screen\ Savers/iTunes\ Artwork.saver 313 | /System/Library/Speech/* 314 | /System/Library/User\ Template/* 315 | /private/var/folders/* 316 | /private/var/log/* 317 | /private/var/vm/sleepimage 318 | /private/var/vm/swapfile* 319 | /usr/X11 320 | /usr/bin/emacs 321 | /usr/bin/emacs-undumped 322 | /usr/bin/php 323 | /usr/lib/mecab/dic 324 | /usr/lib/podcastproducer 325 | /usr/libexec/cups 326 | /usr/share/cups 327 | /usr/share/doc 328 | /usr/share/emacs 329 | /usr/share/gutenprint 330 | /usr/share/man/* 331 | /usr/share/vim" 332 | # Make sure to close out the string here with a quote. 333 | # The string called filesToDelete starts waaaaay up there, and needs to terminate right here with no quotes in between. 334 | # Any file paths with spaces need to use \ and not with quotation marks. 335 | 336 | 337 | 338 | ## here is the actual work 339 | echo "Deleting Files Now!" 340 | deleteTheFile $filesToDelete 341 | 342 | echo "Calculating space used - after shrinking:" 343 | du -ch "$targetVolume" | grep total --------------------------------------------------------------------------------