PowerShell: Restart the Computer

Need to restart a machine as part of a script, after applying an update, or to force a reboot without going through the Start menu? This one-liner restarts it directly from the terminal.

Prerequisites:

  • Privileges: Run as Administrator (for restarting remote machines; not required for restarting the local machine as a standard user in most cases)
  • Module: Built-in, no import needed

Quick Command:

Restart-Computer -Force
📦
Want all of them at once?
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.

How It Works:

  • Restart-Computer restarts the local machine.
  • -Force forces applications to close and the restart to proceed immediately, rather than waiting or prompting.
  • Without -Force, the restart may be delayed or blocked if applications have unsaved changes or are otherwise preventing shutdown.

Pro Tip:

To restart a remote computer instead of the local one, add -ComputerName:

Restart-Computer -ComputerName "RemotePC" -Force