This script is used to keep track of the offline and online status of a device.
Whenever the device restarts or shut down an alert will be sent to you.
Note:
Run this script as Custom monitoring script
Refer the link below
https://scripts.comodo.com/frontend/web/topic/custom-monitoring-script-if-device-went-offline-or-online