

To change the status of Remote Desktop, invoke the SetAllowTSConnections function. If the value of AllowTSConnections is 1, the Remote Desktop feature is active with 0, it's inactive. To obtain the current status of Remote Desktop, retrieve the AllowTSConnections property: Get-CimInstance -Namespace "root\cimv2\TerminalServices" -Class win32_terminalservicesetting | select ServerName, AllowTSConnections

Rather, you have to use WMI, which not only works locally, but also remotely via the ComputerName parameter.

PowerShell doesn't provide its own cmdlet to turn Remote Desktop on or off. There, you will find the link to Remote Desktop, where the corresponding dialog box offers the same settings as the other two GUI options.Īdding accounts to the Remote Desktop Users group is possible via the Local Users and Groups menu item in the left navigation pane. Activate Remote Desktop via the settings of a computer in the Windows Admin Center
