Hi. I have a CMD script file. How to deploy it using policy? I think I need a command line.
Hi
You can use a Worklet for deploying a batch or CMD script file!
Since Automox Worklets use Powershell syntax, you’ll need to upload the cmd or batch file to the payload of the worklet, and then call the file through Powershell in the Remediation Code.
Here is a quick example of running a cmd file from a Worklet:
exit (Start-Process -FilePath ".\BatchFile.cmd" -WindowStyle Hidden -Wait -Passthru).ExitCode
Be sure to replace BatchFile.cmd with the name of the file you upload to the Worklet’s payload:
I hope this helps!
Have a great weekend!
Thank you for the response. How about the Scope area? Use the same code for the Scope and Remediation Code?
A Worklet’s Evaluation Code is used to test a condition on a device, and then trigger the Remediation Code depending on the Exit status. An Exit 0 means the device is complaint and does not need Remediation. Any non-zero Exit value (Exit 1 for example) means the the device is not complaint and will flag the device for Remediation.
With that being said, if you don’t have any Evaluation logic you wish to use, you can pass an Exit 1 and this will flag the device as not compliant and in need of Remediation.
Evaluation Code:
Exit 1
Remediation Code:
exit (Start-Process -FilePath ".\BatchFile.cmd" -WindowStyle Hidden -Wait -Passthru).ExitCode
You can read more about how to use Worklets here:
https://help.automox.com/hc/en-us/articles/5352100773396-How-to-Use-Worklets
I also recommend checking out our Automox University for some great guided courses for using Worklets: https://university.automox.com/page/all-courses#topic_worklets
Reply
Login to the community
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.