How to restart, logoff and shutdown client computer using PowerShell Remotely from Window Server Active Directory?

TechQ 236 Reputation points
2023-02-05T05:56:19.12+00:00

A1

I am logged in to the client computer using PowerShell remotely. I am trying to logoff or restart this client computer but nothing working out. Please let me how to properly turn of the client computer using remote PowerShell.

#Actve Directory #Window Server 2019 Datacenter

Windows for business Windows Client for IT Pros Directory services Active Directory
Windows for business Windows Server User experience PowerShell
Windows for business Windows Server User experience Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Fabricio Godoy 2,626 Reputation points
    2023-02-05T06:28:10.0566667+00:00

    Hi

    To restart cmd:

    shutdown /r /m \PC_name

    To logoff cmd:
    shutdown /l /m\PC_name

    with power shell>

    Restart-Computer -ComputerName PC_NAME -Force

    you cand use a interface too >

    shutdown /i

    Regards

    1 person found this answer helpful.
    0 comments No comments

  2. Mihkel Kiil 11 Reputation points
    2023-02-05T06:28:33.0133333+00:00

    Hello,

    As the error message states, there are users logged in to the computer. They would need to log off before the device is restarted or risk losing data.

    To restart the device regardless, try

    Restart-Computer -Force
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.