Backtrack:  
 
by lunarg on March 17th 2016, at 13:30

There are a variety of methods to enable Remote Desktop and Remote Management from a script. This is particularly useful if you have many Core Servers and no SCCM or some other deployment system.

Powershell:

(Get-WmiObject Win32_TerminalServiceSetting -Namespace root\cimv2\terminalservices).SetAllowTsConnections(1,1)
Set-ExecutionPolicy Unrestricted -Force
Enable-PSRemoting -Force

This enables Remote Desktop with NLA (first param), adjust the required firewall rules (second param), and finally, enables Remote Management.

Batch:

cscript %windir%\system32\scregedit.wsf /ar 0
cscript %windir%\system32\scregedit.wsf /cs 1

Like the PS variant, this enables Remote Desktop while the second line enables NLA. You cannot enable Remote Management through a batch file. Instead, resort to the PS variant.

Sometimes, the batch variant does not change the required firewall rules. If this is the case, run the following to correct it:

netsh advfirewall firewall set rule group="Remote Desktop" new enable=yes
 
 
« August 2017»
SunMonTueWedThuFriSat
  12345
6789101112
13141516171819
20212223242526
2728293031  
 
Links
 
Quote
« You only find out who is swimming naked when the tide goes out. »
Warren Buffett