Jamf Cloud Mount issue

New Contributor

I have Jamf Cloud so I lost the functionality of the normal way of mounting that Jamf does. To compensate I just add Mount /umount to scripts:

sudo Mount_smbfs //guest@server.domain.net/JSS /Volumes
sudo cp -a /volumes/Files/CreateUserAccount.app /users/Administrator/Desktop
sudo umount /Volumes/

This works great when manually run from Self service. However when run via trigger like first login or something like that it gives the error:

Script result: Mount_smbfs: mount error: /Volumes: Operation not permitted<br/>cp: /volumes/Files/adtool.zip: No such file or directory<br/>unzip: cannot find or open /var/tmp/adtool.zip, /var/tmp/adtool.zip.zip or /var/tmp/adtool.zip.ZIP.<br/>rm: /var/tmp/adtool.zip: No such file or directory<br/>umount: /Volumes/: not currently mounted<br/>

For some reason mount errors out whenever it's automated but not when manually run. I've tried with sudo and without. I'm missing something very simple but it's driving me crazy.