View difference between Paste ID: 3V9mQYuG and 5xQagWZQ
SHOW: | | - or go back to the newest paste.
1
@echo off
2
 
3
:: ========================================================================
4
::  Enable Remote Desktop on Windows 7 via batch file
5
::    - runs locally
6
::    - remote is probably only work for domain PCs because of windows firewall
7
::    - to run remotely: copy file to remote computer via smb
8
::      use PSEXEC to connect to the remote computer and run batch
9
::    - once run remote desktop will be accessible via domain name
10
::      ie: [machineName].{domain}.{suffix}
11
::    - updated 3/6/14 to force the reg entry and stop and start services differently
12
:: ========================================================================
13
 
14
echo disable firewall
15
netsh advfirewall set currentprofile state off
16
 
17
echo add firewall rule for RD
18
netsh advfirewall firewall set rule group=”remote desktop” new enable=Yes
19
 
20
echo auto start remote registry
21
sc config RemoteRegistry start= auto
22
 
23
echo start remote registry
24
net start RemoteRegistry
25
 
26
echo force accept of RD connections
27
reg add "HKLM\system\currentcontrolset\control\terminal server" /v "fDenyTSConnections" /t REG_DWORD /d 0x0 /f
28
 
29
echo make RD autostart
30
sc config TermService start= auto
31
 
32
echo make RD umRdp auto start
33
sc config UmRdpService start= auto
34
 
35
echo stop umrdp
36
net stop UmRdpService
37
 
38
echo stop and restart terminal service
39
echo y|net stop TermService
40
net start TermService
41
42
echo enable remote desktop exception
43
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes profile=domain 
44
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes profile=private
45
46
echo turn on firewall
47
netsh advfirewall set currentprofile state on
48
 
49
:: remove REM if you want to see what happens running locally
50
REM pause