How to restart the computer from PowerShell

To restart a computer from PowerShell prompt or in the script, you can use the command Restart-Computer

Restart-Computer

To restart the computer after your confirmation, use the following syntax.

Restart-Computer -Confirm

PowerShell will prompt for confirmation, as shown below.

  • When prompted: Are you sure you want to perform this action?
  • Give Y
  • Your computer will be restarted

Reference: Powershell.management/restart-computer