Category filter

How to execute custom scripts periodically on Windows

Executing scripts on managed devices is an efficient way for IT admins to perform various actions and retrieve information. However, in cases where scripts need to be executed multiple times a day or at regular intervals, manually deploying them each time would significantly reduce efficiency. In such instances, automating script execution is the ideal solution. The Scripts feature allows IT admins to execute custom scripts on Windows periodically, specifically during device startup and user logon.

Note:

  • Supported on Windows 10 running v1703+.
  • Supported script file formats: .bat, .cmd, .ps1
  • This feature requires the latest version of the Hexnode UEM agent to be installed on the device.

How to schedule the periodic execution of scripts?

  1. Login to the Hexnode UEM console.
  2. Navigate to Policies > Windows > Configurations > Scripts and click Configure.
  3. Click Choose Scripts.
  4. In the Choose File dialog box:
    • Choose script file source
      • Select Upload file to upload the script to the Hexnode content repository.
      • Select Hexnode repository to select a script already present in the Hexnode content repository. You can also use Hexnode Genie to generate a new script.
    • File name – The file name will be auto populated based on the uploaded/selected script.
    • Arguments – If the selected script includes arguments, enter them here, separated by spaces. If a single argument contains spaces, enclose it in single quotes. The field also supports the use of wildcards.
    • Set output file path – Specify the location on the device where the script’s output should be stored.
  5. Click Configure.
  6. In the Script Configurations dialog box:
    • Timeout – The script will be forcibly terminated if it does not complete execution within the configured time period. The timeout value can be set between 15 and 90 minutes.
    • Execute scripts on – Select the event that should trigger the script execution: User logon or Device startup.
    • Script frequency – Specify how often the script should be executed. The options are:
      • Every user log on/device startup: Select the Execute till checkbox to specify the date until which the script should be executed.
      • Subsequent user log on/device startup: Enter the number of subsequent logins (1 to 100) during which the script should be executed.
    • Retry if the script execution fails: Select this option to retry the script execution if it fails.
    • Maximum number of retries: Specify the number of retries for the script execution in case of failure, with a maximum of 5 retries allowed.
    • Retry: Enter the time interval after which the script should be retried following the initial failure.

  7. Click Add.
  8. Associate the policy to the target devices by navigating to Policy Targets > +Add Devices.
  9. Select the target devices and click OK.
  10. Click Save.
  11. Check script execution status from Hexnode UEM console

    Once the policy is associated with the devices, you can view the status of the script execution under the Scripts sub-tab in the Manage tab of the respective devices.

    Check the status of script execution

  • Managing Windows Devices