Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- :: ========================================================================
- :: Enable Remote Desktop on Windows 7 via batch file
- :: - runs locally
- :: - remote is probably only work for domain PCs because of windows firewall
- :: - to run remotely: copy file to remote computer via smb
- :: use PSEXEC to connect to the remote computer and run batch
- :: - once run remote desktop will be accessible via domain name
- :: ie: [machineName].{domain}.{suffix}
- :: - updated 3/6/14 to force the reg entry and stop and start services differently
- :: ========================================================================
- echo disable firewall
- netsh advfirewall set currentprofile state off
- echo add firewall rule for RD
- netsh advfirewall firewall set rule group=”remote desktop” new enable=Yes
- echo auto start remote registry
- sc config RemoteRegistry start= auto
- echo start remote registry
- net start RemoteRegistry
- echo force accept of RD connections
- reg add "HKLM\system\currentcontrolset\control\terminal server" /v "fDenyTSConnections" /t REG_DWORD /d 0x0 /f
- echo make RD autostart
- sc config TermService start= auto
- echo make RD umRdp auto start
- sc config UmRdpService start= auto
- echo stop umrdp
- net stop UmRdpService
- echo stop and restart terminal service
- echo y|net stop TermService
- net start TermService
- echo enable remote desktop exception
- netsh advfirewall firewall set rule group="remote desktop" new enable=Yes profile=domain
- netsh advfirewall firewall set rule group="remote desktop" new enable=Yes profile=private
- echo turn on firewall
- netsh advfirewall set currentprofile state on
- :: remove REM if you want to see what happens running locally
- REM pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement