I am trying to run the bash script below to uninstall virtualbox on some of our clients. I have parameter 4 as being --unattended but when the script runs it generates an error for the unknown arguments: / <hostname> <user>
Is there a way to ignore the first three parameters in the bash script or through the jss console? The script works as expected when I run directly on the client without the first three parameters passed by JAMF (./virtualbox_uninstall.sh --unattended).
I ended up using my_default_prompt="Yes" while commenting out the 'if test..' code block to get past this error and it seems to work with parameter 4: --unattended
Would still be interesting to know whether there is an easy way to prevent the first three parameters from being passed. Something as simple as a checkbox for 'Ignore JSS Parameters' would be nice. Thank you.
Are you imported the script directly into the JSS or something?
If you are and it is only expecting one parameter then your pretty much going to have to edit the script
Alternatively you could deliver the script to the client machine unaltered (as a dmg for example) and then use another script or commnad line call to launch it locally with the correct parameters.
Thank you for the responses. Yes, the script was imported directly into JSS. I am aware JSS will pass the first three parameters automatically. I was trying to figure out how to prevent this instead of just modifying the code which is what @Look suggests as the solution. I would like a way to prevent the JSS from passing the first three parameters but it looks like that is not possible at the moment.
Jamf's behavior hasn't changed and I doubt it's likely going to change.
The problem in the case above is with the removal script itself. It simply wasn't written to be copied/pasted into Jamf Pro and run as a Jamf Pro script. It should either be deployed to a Mac as a file and then called using a Policy's Execute Command option under Files & Processes or it should be modified to use one of Jamf's script parameters 4-11.