Category filter

Script to Shut Down Windows 10 devices

An admin might need to shut down Windows devices remotely from time to time when managing a fleet of devices. Hexnode allows admins to run commands to shut down or schedule shutdown of Windows devices with a specified delay using Execute Custom Script action. This document contains the code snippets for shutting down your device.

Disclaimer:

The sample scripts provided below are adapted from third-party open-source sites.

Batch script

Once the command is executed, the device shuts down, after displaying a warning message.

By customizing the last parameter of the command, you can schedule shutdown to proceed after the specified number of seconds. Say, to shut down the device in 15 seconds,

Schedule a shut down on Windows devices

Powershell script

Stop-Computer : cmdlet used to shut down or restart a computer.

-ComputerName :parameter that specifies the name or IP address of the remote computer that you want to shut down or restart.

-force :optional parameter that forces the remote computer to shut down or restart without prompting for confirmation.

Replace “computer_name” with the name or IP address of the remote computer that you want to shut down or restart.

Notes:

  • 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