Showing posts with label Windows 7. Show all posts
Showing posts with label Windows 7. Show all posts

Windows 7+ Firewall Security Script

Windows 7+ Firewall Security Script


net user CyberNexusSAIC password /add 
net localgroup administrators CyberNexusSAIC /add
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
netsh advfirewall firewall add rule name=" " dir=in action=allow protocol=TCP localport=3389
netsh advfirewall firewall add rule name=" " dir=in action=allow protocol=UDP localport=3389

Enable Remote Desktop on Windows 7 via batch file

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}

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