Category filter

Script to collect MDM logs for Windows devices

Here is a custom script that helps IT administrators collect MDM logs for Windows devices. The logs generated at the device consist of agent logs, installer logs, updater logs, and MDM diagnostic reports to facilitate troubleshooting and device monitoring. Administrators can view these logs collected at the device to diagnose device management or enrollment issues for the Windows endpoints enrolled in Hexnode UEM. To execute these commands on the target devices, use Hexnode’s Execute Custom Script action.


The Sample Scripts provided below are adapted from third-party Open-Source sites.

Collect MDM logs for Windows devices in Hexnode

The script creates a folder at C:\Hexnode\Logs\LogCollection to save the logs generated. The logs are saved into this folder as a zip file named The IT admin can then retrieve this to diagnose issues.


  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository