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

Start the H2 database in server mode via Spring

Start the H2 database in server mode via Spring

<bean id="org.h2.tools.Server" class="org.h2.tools.Server"
    factory-method="createTcpServer" init-method="start" destroy-method="stop">
    <constructor-arg value="-tcp,-tcpAllowOthers,true,-tcpPort,8043" />
    </bean>

    <bean id="org.h2.tools.Server-WebServer" class="org.h2.tools.Server"
    factory-method="createWebServer" init-method="start">
    <constructor-arg value="-web,-webAllowOthers,true,-webPort,8082" />
    </bean>
<beans default-lazy-init="true" ...
import org.h2.tools.Server;
...
// start the TCP Server
Server server = Server.createTcpServer(args).start();
...
// stop the TCP Server
server.stop();


Start the H2 database in server mode via Spring