Search notes:

PowerShell cmdLet Restart-Computer

Failed to restart the computer ‥

The system shutdown cannot be initiated because there are other users logged on to the computer.

Apparently, restart-computer checks if there are still users logged on and fails with Failed to restart the computer ssva24025 with the following error message: The system shutdown cannot be initiated because there are other users logged on to the computer. if this is the case.
It is however possible to use the -force parameter which restarts the computer anyway.

Failed to restart the computer ‥ with the following error message: system shutdown is in progress.

An already initiated system shutdown blocked the restarting of the computer:
PS: C:\> restart-computer tq84srv -credential (get-cred)
Restart-Computer : Failed to restart the computer tq84srv with the following error message: A system shutdown is in progress.
In this case, I had to kill the TrustedInstaller process:
PS: C:\> taskkill /s tq84srv /u rene /p mySecretPassword /im TrustedInstaller.exe /f
SUCCESS: The process "TrustedInstaller.exe" with PID 4312 has been terminated.

PS: C:\> restart-computer tq84srv -credential (get-cred)

See also

The command parameter -credential.
Powershell command noun: computer

Index