Where are the examples scripts for Casper/Jamf Pro?

New Contributor

I don't see this as part of the install.



Legendary Contributor III

I'm not sure what you mean by example scripts. There are template Extension Attributes in the JSS (which are mostly all script based) and there are scripts located here on JamfNation related to products or other functions. But I don't know of example scripts that would be used in say, a policy that come as part of the install. Unless that's something very new.

New Contributor III

Lots of scripts here on Jamf Nation. Are you needing help with something specific?

New Contributor

Thanks. I read there was a bashexample.sh test script that came with Casper that would be good to check out. But my Real problem is that I found a script online (Remove2011) and I put it in JSS but I'm getting an Exit Code 1. Am I suppose to edit this script? Or I am Suppose to enter some parameters in the policy? Not sure how to do either.

Legendary Contributor III

@Vernaf I think you'd need to post the script here or a link to it for us to look at to help you. It's virtually impossible for anyone to tell you why a script is exiting code 1, or guide you on what to do, without actually looking at the script.

Contributor II

The problem with this script is that it's intended to run in user context. Jamf Pro runs scripts as root, so you need to add the local $USER context. I've edited it for my context here: https://github.com/koalatee/scripts/blob/master/jamf/MS_OfficialRemoveOffice2011.sh

I've added it to a package then run this command (in the same policy) after the pkg has been installed:
'sh /$path_to_script/MS_OfficialRemoveOffice2011.sh --force'

New Contributor

So it installs as a package, it doesn't actually do anything until it's triggered by the command which is set to run after the install. Correct? Does it matter the location of the install or does the command finds it on it's own?

Valued Contributor

Scripts our very helpful in completing task that profiles cannot accomplish. I prefer using scripts to mount our network drives because I find it is more reliable than profiles. Here is an example of a drive mount script I use.

# Script to mount network drives.

theuser=$(/usr/bin/who | awk '/console/{ print $1 }')
/usr/bin/osascript > /dev/null << EOT

        tell application "Finder" 
        mount volume "INSERT PATH TO VOLUME HERE "
        end tell


echo $theuser
killall cfprefsd
defaults write com.apple.finder ShowMountedServersOnDesktop true
killall -HUP Finder