Skip to content

Instantly share code, notes, and snippets.

@BoQsc
Created October 21, 2019 08:44
Show Gist options
  • Save BoQsc/5e4663a3f13a30f04d933cb1ba5f98de to your computer and use it in GitHub Desktop.
Save BoQsc/5e4663a3f13a30f04d933cb1ba5f98de to your computer and use it in GitHub Desktop.
This Batch script Adds a Windows Defender Firewall rule to block any HTTPS (443 port) connections
@ECHO OFF
REM Make the all HTTPS internet sites temporary inaccesible on the whole computer by adding Windows Defender Firewall rule.
REM An "Outbound" Firewall Rule will be added to the Windows Defender Firewall, named "Block internet access to 443 HTTPS protocol temporary for the whole computer session"
REM If Firewall rule named "Block internet access to 443 HTTPS protocol temporary for the whole computer session" already exists - it will be removed
REM Notice: requires administrator's privilegies to remove or add Windows Defender Firewall rule.
netsh advfirewall firewall show rule name="Block internet access to 443 HTTPS protocol temporary for the whole computer session"
if %ERRORLEVEL% equ 0 netsh advfirewall firewall delete rule name="Block internet access to 443 HTTPS protocol temporary for the whole computer session"
if %ERRORLEVEL% equ 1 netsh advfirewall firewall add rule name="Block internet access to 443 HTTPS protocol temporary for the whole computer session" dir=out action=block protocol=TCP remoteport=443 enable=yes profile=any
echo %ERRORLEVEL%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment