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 Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
13,702 questions
Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,887 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,627 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Fabricio Godoy 2,611 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.