Please check this wiki explaining how to Run MAC OS Script Procedure
https://wiki.itarian.com/frontend/web/topic/how-to-configure-and-run-procedures-on-managed-devices#create_mac_script_procedure
Pass the sudo password in "sudo_pass" variable and on/off in "on_off" variable.
Note:
1.Run as Logged user
2.Run as Local System user