Skip to main content
Question

Why doesn't my Skript get executed via Policy?


Forum|alt.badge.img+1

Hey,

I am trying to run a "Mac-Renaming" Skript via Policy, but it shows me something like this in the policy log:

 

 

 

if i run the skript on the mac itself it works just fine, but as soon as I try to deploy it via Policy i get this error.

here is the Skript:

#!bash/sh

arr=( $(ls /users) )

str=${arr[@]:3}

year=$(date +%Y)-

lengthUsername=${#str}

substr="${str:2:$lengthUsername}"

sudo /usr/local/bin/jamf setcomputername -name "$year$substr"

sudo /usr/local/bin/jamf recon

 

can someone help me to find the issue?

2 replies

Bol
Forum|alt.badge.img+11
  • Contributor
  • 276 replies
  • March 23, 2022

Change this line;

#!bash/sh

To;

#!/bin/sh


DBrowning
Forum|alt.badge.img+24
  • Esteemed Contributor
  • 668 replies
  • March 23, 2022

I'd try changing #!bash/sh to either #!/bin/bash or #!/bin/sh


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings