Losoft Command line reference
Transport: SMB / TCP 445
Right: REMOTE SHUTDOWN
EN DE

Remote Shutdown on Windows from the Command Line: Reboot, Logoff and Hibernate

Powering a machine down over the network looks like one operation and is really two. Some power states have a remote interface and some only exist locally, and the split explains nearly every confusing result in this area, including why a remote shutdown from the command line succeeds while the same command with a different flag is refused outright.

Diagram of a shutdown request travelling from a console to a remote host over SMB, with the local power manager handling sleep states.

What shutdown.exe does over the network

The built-in command takes a target with /m and one action. Shutdown and restart work against a remote host; a delay, a message and a reason code can travel with them. Logoff does not; sessions are not owned by the machine.

C:\> shutdown /r /m \\FS01 /t 120 /c "Patch window, back in 5 minutes" /d p:2:4

C:\> shutdown /s /m \\LAB-07 /t 0 /f          ← force, no prompts, unattended
C:\> shutdown /a /m \\FS01                        ← abort a countdown still running
C:\> shutdown /i                                   ← dialog, accepts a list of machines

Three flags carry most of the meaning. /t sets a countdown, and a countdown is what makes the operation abortable. With /t 0 there is nothing left to cancel. /f stops negotiating with applications, which is what an unattended restart needs and what loses an unsaved document. /d writes a reason into the event log, which matters on any server whose restarts are reported on.

Why hibernate and sleep are not on that list

Shutdown and restart are exposed through an interface the operating system offers to remote callers. Suspend and hibernate are not: they are decisions the local power manager makes about the local machine, and there is no remote entry point to ask for them. This is a design boundary rather than a missing feature, and no amount of privilege changes it.

Which leaves a real gap, because "put the lab to sleep overnight" is a reasonable request. The only way across the boundary is to have something already running on the target make the local call. Every tool that has ever offered remote hibernate does this, and the mechanism is worth understanding because it also explains their side effects.

Remote reach by power state

Shutdown
Remote interface. shutdown /s /m
Restart
Remote interface. shutdown /r /m
Logoff
Session-scoped; remote only via a session-management tool, not /l
Power off (soft off)
Local power manager. Needs code running on the target
Suspend
Local power manager. Needs code running on the target
Hibernate
Local power manager. Needs code running on the target
Wake
Not a shutdown call at all: wake-on-LAN packet or firmware timer

The copy-and-register technique, and what it leaves behind

Down.exe, one of a small freeware collection published for Windows NT, is a clear example because its documentation stated the trick plainly. Asked to power off, suspend or hibernate a remote machine, it copied itself and its helper library into the target's system directory over the administrative share, registered itself there as a service, and started that service, which then made the local power call.

down [\\COMPUTER [/C | /I]] [/R | /L | /P | /S | /H | /A] [/Q] [/F]
     [/U:Username,Password] [Time] [Message]

  /C  copy over an existing copy on the target      /R  reboot
  /I  install only, do not shut down                /L  log off (local only)
  /P  power off        /S  suspend        /H  hibernate     /A  abort a pending operation
  /Q  no confirmation  /F  force applications closed
  /U  authenticate as this account

Two consequences follow from that design, and both apply to any tool built the same way. It needs administrative rights and a reachable administrative share; a hardened machine with that share disabled cannot be reached at all unless the files are placed there by hand once. And it does not clean up: the executable and its library stay in the system directory afterwards, deliberately, so that the second call is cheap. That is a sensible trade for a lab and a poor one for a managed estate, where an unmanaged binary in a system directory is exactly what inventory tooling is meant to flag.

The modern versions of the same idea are a scheduled task, a remote command session, or a management agent. All three do the work on the target and all three are auditable, which is the part the copy-a-binary approach lacks.

Rights, transport and the errors they produce on Windows

A remote shutdown from the command line needs the calling account to hold "Force shutdown from a remote system" on the target, and it needs TCP 445 reachable, because the call travels over SMB. Those two requirements produce two distinct failures that are easy to confuse.

An access-denied result means the connection succeeded and the right is missing: check the privilege assignment on the target, not the firewall. A timeout or a network-path error means the call never arrived, which is a closed port, a name that does not resolve, or a host that is genuinely off. The quickest discriminator is that a machine which answers net use \\\\HOST\\IPC$ has an open path and therefore a rights problem.

One more asymmetry worth knowing: logoff is not remotable through this command. Sessions belong to a session manager rather than to the machine, so logging somebody off another computer goes through session-management tooling instead. Passing /l with /m is rejected, and the rejection is correct.

Scripting remote shutdown from the command line without leaving debris

For shutdown and restart, loop the built-in command and keep a small delay between hosts. For the states that have no remote interface, register a task on each machine once and trigger the task remotely. The power call then runs locally, which is the only thing that was ever required.

# once per machine, at build time
schtasks /create /s LAB-07 /tn "Suspend" /tr "rundll32.exe powrprof.dll,SetSuspendState 1,1,0" ^
         /sc once /st 00:00 /ru SYSTEM

# any time after that
schtasks /run /s LAB-07 /tn "Suspend"

The result is the same capability the older utility offered, with the difference that the thing left on the target is a registered task rather than an undocumented binary. On a handful of machines the distinction is cosmetic. On a few hundred it is the difference between a documented estate and a set of surprises.

Questions about remote shutdown and power states

Why does shutdown /m work but /h refuse?

Because they are different calls. Shutdown and restart go through a documented remote interface that the service control manager exposes. Hibernate and sleep are handled by the local power manager, which has no remote entry point at all. The flag is rejected before anything reaches the network.

Which right does a remote shutdown need?

"Force shutdown from a remote system" on the target machine, held by the calling account. It is separate from "Shut down the system", which governs local shutdown, and a member of the local administrators group holds both by default. Removing the remote right is a legitimate hardening step and a frequent cause of access-denied on an otherwise correct command.

What has to be open on the firewall?

The remote call travels over SMB, so TCP 445 has to be reachable, and on a domain-joined machine the "Windows Management Instrumentation" and file-and-printer-sharing rules usually cover it. A host that answers a ping and refuses a shutdown is almost always a closed 445 rather than a rights problem.

Can I cancel a countdown I already started?

Yes, until it expires: shutdown /a /m \\HOST aborts a pending shutdown or restart. This only works while the timer is running, which is the practical argument for always setting a delay rather than going immediately.

Why did the machine restart instead of powering off?

Almost always firmware or driver behaviour rather than the command. A machine configured to wake on a network event, or one whose power-state handling is incomplete, will come straight back up. Check the wake sources with powercfg /devicequery wake_armed before blaming the call.

Does a forced shutdown lose unsaved work?

Yes. The force flag stops asking applications whether they are ready and closes them, which is exactly what makes an unattended shutdown reliable and exactly what loses a document. Use it for servers and lab machines, and set a delay with a message for anything a person is sitting at.

Is there a way to hibernate a remote machine at all?

Only by running something on the machine itself: a scheduled task, a remote command session, or a management agent that invokes the local power call. That is precisely the technique the older utilities used: copy a small executable to the target, register it as a service, start it, and let it make the local call.

What does the /d reason code change?

It writes a planned-or-unplanned classification and a major/minor reason into the event log entry, which is what a shutdown report reads later. It changes nothing about the operation, and on servers configured to demand a reason it is the difference between a logged restart and an unexplained one.

How do I shut down a list of machines?

Loop the command over the list and collect exit codes, or use the PowerShell equivalent with a computer-name array. The important detail is the delay: staggering by a few seconds avoids a burst of simultaneous authentication against the same domain controller, which on a large list is a real failure mode.

Is the graphical shutdown dialog still available?

Yes, shutdown /i opens it, and it accepts a list of machines and applies one action to all of them. It is the quickest route for a handful of hosts and the wrong one for anything repeatable.

← Previous: Service permissions Reviewed: 2026-08-02 Next: Explorer tags →