Skip to main content
Question

Where are the examples scripts for Casper/Jamf Pro?

  • September 22, 2017
  • 7 replies
  • 49 views

Forum|alt.badge.img+4

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

Thanks.

7 replies

mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • September 22, 2017

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.


Forum|alt.badge.img+4
  • Contributor
  • September 22, 2017

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


Forum|alt.badge.img+4
  • Author
  • Contributor
  • September 22, 2017

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.


mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • September 22, 2017

@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.


Forum|alt.badge.img+7
  • Contributor
  • September 22, 2017

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'


Forum|alt.badge.img+4
  • Author
  • Contributor
  • September 23, 2017

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?


Forum|alt.badge.img+14
  • Valued Contributor
  • September 23, 2017

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.

#!/bin/bash
# Script to mount network drives.

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

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


EOT

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