Table of Contents
Problem
Restart-Computer -ComputerName 10.10.5.56 -Credential admin
If you intend to shut down, or restart a remote computer using PowerShell, you may see the following error message:
Note
PS C:Usersadmin> Restart-Computer -ComputerName 10.10.5.56 -Credential admin Restart-Computer : Failed to restart the computer 10.10.5.56 with the following error message: The system shutdown cannot be initiated because there are other users logged on to the computer. At line:1 char:1 + Restart-Computer -ComputerName 10.10.5.56 -Credential admin + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (10.10.5.56:String) [Restart-Computer], InvalidOperationException + FullyQualifiedErrorId : RestartcomputerFailed,Microsoft.PowerShell.Commands.RestartComputerCommand

Solution
You need to add the -Force flag to the command like so:
Restart-Computer -ComputerName 10.10.5.56 -Credential admin -Force
As you can see, the error was gone, and the remote computer is restarted.





