We help IT Professionals succeed at work.

Turn on remote access on a remote computer

As an administrator, is there a way to turn on Remote Access on a remote computer on an internal network?
Watch Question

Director, Information Systems
This PowerShell command will enable Remote Desktop on a remote computer:
    Invoke-Command -Computername <computer name> -ScriptBlock {Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" –Value 0 }
...while this one will open a firewall port to allow Remote Desktop connections:
    Invoke-Command -Computername <computer name> -ScriptBlock {Enable-NetFirewallRule -DisplayGroup "Remote Desktop"}

This can also be done via Group Policy under
     Computer Configuration > Administrative Templates > Windows Components >Remote Desktop Services > Remote Desktop Session Host > Connections
...while the firewall policy is here:
     Computer Configuration > Policies > Administrative Templates > Network > Network Connections > Windows Firewall > Domain Profile

Source: Enable Remote Desktop remotely on Windows 10
Distinguished Expert 2019

Is the machine on an AD domain? You could leverage GPO....
Dimitris MaleasData recovery engineer

Download PsExec from sysinternals
psexec \\yourremotemachine reg add "hklm\system\currentcontrolset\control\terminal server" /f /v fDenyTSConnections /t REG_DWORD /d 0
psexec \\ yourremotemachine netsh firewall set service remoteadmin enable
psexec \\ yourremotemachine netsh firewall set service remotedesktop enable