Check for file

Does anyone have any experience creating a worklet to check for a specific file and alert if the file is present in the directory? We are looking to create a worklet that will check for a specific file every hour, and if the file is there, send an alert to the necessary individuals.

That seems like something that would be suitable for an antivirus software or something that is constantly monitoring the system. Automox isn’t setup to handle such a task, as the most you can do is scan every 6 hours currently. You can do a simple Test-Path command in powershell and a remediation of Remove-Item. Not sure how you would do alerting however. Additionally, you would have to setup multiple worklet policies since currently AX can only be scheduled to run once a day at most.

Hope this helps!

Here’s a worklet that is similar that you could modify for your purposes:

If you’re wanting it to check every hour that would require a workaround since each worklet can only be scheduled to run once an day. You’d need 24 copies of the worklet, each set to fire at a different hour.

For something that needs to be checked that often you might be better off with a scheduled task that checks for the file and then fires a notification.