Skip to content

Instantly share code, notes, and snippets.

@ph33nx
Last active July 19, 2024 14:55
Show Gist options
  • Save ph33nx/0ed14724213c4cc467c85826c9dca908 to your computer and use it in GitHub Desktop.
Save ph33nx/0ed14724213c4cc467c85826c9dca908 to your computer and use it in GitHub Desktop.
Block All Adobe .exe files via Firewall on Windows Using Batch Script | Stop adobe apps to access internet
@REM Author: https://github.com/ph33nx
@REM Description: This script blocks or unblocks Adobe-related executables in Windows Firewall.
@REM Usage:
@REM - To block executables: adobe_block.bat
@REM - To unblock (delete) existing rules: adobe_block.bat -delete
@echo off
setlocal enabledelayedexpansion
REM Check if the script should delete existing rules
if /i "%1"=="-delete" (
echo Deleting existing firewall rules...
for /f "tokens=*" %%r in ('powershell -command "(Get-NetFirewallRule | where {$_.DisplayName -like '*adobe-block'}).DisplayName"') do (
netsh advfirewall firewall delete rule name="%%r"
)
echo Firewall rules deleted successfully.
pause
goto :eof
)
REM Process each folder and block executables
if exist "C:\Program Files\Adobe" (
for /R "C:\Program Files\Adobe" %%X in (*.exe) do (
echo Blocking: %%~nX
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=out program="%%X" action=block
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=in program="%%X" action=block
)
)
if exist "C:\Program Files\Common Files\Adobe" (
for /R "C:\Program Files\Common Files\Adobe" %%X in (*.exe) do (
echo Blocking: %%~nX
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=out program="%%X" action=block
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=in program="%%X" action=block
)
)
if exist "C:\Program Files\Maxon Cinema 4D R25" (
for /R "C:\Program Files\Maxon Cinema 4D R25" %%X in (*.exe) do (
echo Blocking: %%~nX
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=out program="%%X" action=block
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=in program="%%X" action=block
)
)
if exist "C:\Program Files\Red Giant" (
for /R "C:\Program Files\Red Giant" %%X in (*.exe) do (
echo Blocking: %%~nX
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=out program="%%X" action=block
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=in program="%%X" action=block
)
)
if exist "C:\Program Files (x86)\Adobe" (
for /R "C:\Program Files (x86)\Adobe" %%X in (*.exe) do (
echo Blocking: %%~nX
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=out program="%%X" action=block
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=in program="%%X" action=block
)
)
if exist "C:\Program Files (x86)\Common Files\Adobe" (
for /R "C:\Program Files (x86)\Common Files\Adobe" %%X in (*.exe) do (
echo Blocking: %%~nX
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=out program="%%X" action=block
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=in program="%%X" action=block
)
)
echo Blocking completed.
pause
endlocal
@Gomufra
Copy link

Gomufra commented Jun 23, 2024

¡Hola! ¿Como puedo revertir el script? Gracias <3

@axeltbraun
Copy link

Thank's great job, appreciate

@roggerwilliam
Copy link

roggerwilliam commented Jun 23, 2024

For Autodesk:

@REM Author: https://github.com/ph33nx

@REM Description: This script blocks or unblocks Adobe-related executables in Windows Firewall.
@REM Usage:
@REM   - To block executables: adobe_block.bat
@REM   - To unblock (delete) existing rules: adobe_block.bat -delete

@echo off
setlocal enabledelayedexpansion

REM Check if the script should delete existing rules
if /i "%1"=="-delete" (
    echo Deleting existing firewall rules...
    for /f "tokens=*" %%r in ('powershell -command "(Get-NetFirewallRule | where {$_.DisplayName -like '*autodesk-block'}).DisplayName"') do (
        netsh advfirewall firewall delete rule name="%%r"
    )
    echo Firewall rules deleted successfully.
    pause
    goto :eof
)

REM Process each folder and block executables
if exist "C:\Program Files\Autodesk" (
    for /R "C:\Program Files\Autodesk" %%X in (*.exe) do (
        echo Blocking: %%~nX
        netsh advfirewall firewall add rule name="%%~nX autodesk-block" dir=out program="%%X" action=block
        netsh advfirewall firewall add rule name="%%~nX autodesk-block" dir=in program="%%X" action=block
    )
)

if exist "C:\Program Files (x86)\Common Files\Macrovision Shared" (
    for /R "C:\Program Files (x86)\Common Files\Macrovision Shared" %%X in (*.exe) do (
        echo Blocking: %%~nX
        netsh advfirewall firewall add rule name="%%~nX autodesk-block" dir=out program="%%X" action=block
        netsh advfirewall firewall add rule name="%%~nX autodesk-block" dir=in program="%%X" action=block
    )
)

if exist "C:\Program Files (x86)\Common Files\Autodesk Shared" (
    for /R "C:\Program Files (x86)\Common Files\Autodesk Shared" %%X in (*.exe) do (
        echo Blocking: %%~nX
        netsh advfirewall firewall add rule name="%%~nX autodesk-block" dir=out program="%%X" action=block
        netsh advfirewall firewall add rule name="%%~nX autodesk-block" dir=in program="%%X" action=block
    )
)

echo Blocking completed.
pause
endlocal

@roggerwilliam
Copy link

For Corel:

@REM Author: https://github.com/ph33nx
@REM Description: This script blocks or unblocks Adobe-related executables in Windows Firewall.
@REM Usage:
@REM   - To block executables: adobe_block.bat
@REM   - To unblock (delete) existing rules: adobe_block.bat -delete

@echo off
setlocal enabledelayedexpansion

REM Check if the script should delete existing rules
if /i "%1"=="-delete" (
    echo Deleting existing firewall rules...
    for /f "tokens=*" %%r in ('powershell -command "(Get-NetFirewallRule | where {$_.DisplayName -like '*Corel-block'}).DisplayName"') do (
        netsh advfirewall firewall delete rule name="%%r"
    )
    echo Firewall rules deleted successfully.
    pause
    goto :eof
)

REM Process each folder and block executables
if exist "C:\Program Files\Corel" (
    for /R "C:\Program Files\Corel" %%X in (*.exe) do (
        echo Blocking: %%~nX
        netsh advfirewall firewall add rule name="%%~nX Corel-block" dir=out program="%%X" action=block
        netsh advfirewall firewall add rule name="%%~nX Corel-block" dir=in program="%%X" action=block
    )
)

if exist "C:\Program Files (x86)\Corel" (
    for /R "C:\Program Files (x86)\Corel" %%X in (*.exe) do (
        echo Blocking: %%~nX
        netsh advfirewall firewall add rule name="%%~nX Corel-block" dir=out program="%%X" action=block
        netsh advfirewall firewall add rule name="%%~nX Corel-block" dir=in program="%%X" action=block
    )
)

if exist "C:\Program Files\Common Files\Corel" (
    for /R "C:\Program Files\Common Files\Corel" %%X in (*.exe) do (
        echo Blocking: %%~nX
        netsh advfirewall firewall add rule name="%%~nX Corel-block" dir=out program="%%X" action=block
        netsh advfirewall firewall add rule name="%%~nX Corel-block" dir=in program="%%X" action=block
    )
)

echo Blocking completed.
pause
endlocal

@joelismgrim
Copy link

Thank you so much!

@Gomufra
Copy link

Gomufra commented Jul 4, 2024

Hi! How can I revert the script? Thank you <3

@hannemaster
Copy link

Hi! How can I revert the script? Thank you <3

Read line 5 in the script.

@spidy2356
Copy link

@hannemaster how to execute -delete flag, i mean, what will be the full cmd?

@roggerwilliam
Copy link

@hannemaster how to execute -delete flag, i mean, what will be the full cmd?

open cmd admin mode in the file directory. Write: adobe_exe_firewall_block_windows.bat -delete

@spidy2356
Copy link

spidy2356 commented Jul 7, 2024

@roggerwilliam tried bro, but it not working .
error - "'adobe_exe_firewall_block_windows.bat' is not recognized as an internal or external command,
operable program or batch file."
should I paste it on system32 directory or locate the directory first?

edit: worked. thank u so much

@mcfly90
Copy link

mcfly90 commented Jul 8, 2024

Hello, someone have the unblock script please

@hannemaster
Copy link

Added a choice menu, so people can more easily remove it without going to command-line. It simply asks for (c)reate or (d)elete.

`@REM Author: https://github.com/ph33nx
@Rem Description: This script blocks or unblocks Adobe-related executables in Windows Firewall.
@Rem Usage:
@Rem - To block executables: adobe_block.bat
@Rem - To unblock (delete) existing rules: adobe_block.bat -delete

@echo off
setlocal enabledelayedexpansion

:choicepart
set choice=
set /p choice=Type C to create or D for delete firewall blocks:
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='C' goto createpart
if '%choice%'=='D' goto deletepart
if '%choice%'=='c' goto createpart
if '%choice%'=='d' goto deletepart
goto choicepart

REM Check if the script should delete existing rules
if /i "%1"=="-delete" (
:deletepart
echo Deleting existing firewall rules...
for /f "tokens=*" %%r in ('powershell -command "(Get-NetFirewallRule | where {$_.DisplayName -like '*adobe-block'}).DisplayName"') do (
netsh advfirewall firewall delete rule name="%%r"
)
echo Firewall rules deleted successfully.
pause
goto :eof
)

:createpart
REM Process each folder and block executables
if exist "C:\Program Files\Adobe" (
for /R "C:\Program Files\Adobe" %%X in (*.exe) do (
echo Blocking: %%~nX
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=out program="%%X" action=block
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=in program="%%X" action=block
)
)

if exist "C:\Program Files\Common Files\Adobe" (
for /R "C:\Program Files\Common Files\Adobe" %%X in (*.exe) do (
echo Blocking: %%~nX
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=out program="%%X" action=block
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=in program="%%X" action=block
)
)

if exist "C:\Program Files\Maxon Cinema 4D R25" (
for /R "C:\Program Files\Maxon Cinema 4D R25" %%X in (*.exe) do (
echo Blocking: %%~nX
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=out program="%%X" action=block
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=in program="%%X" action=block
)
)

if exist "C:\Program Files\Red Giant" (
for /R "C:\Program Files\Red Giant" %%X in (*.exe) do (
echo Blocking: %%~nX
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=out program="%%X" action=block
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=in program="%%X" action=block
)
)

if exist "C:\Program Files (x86)\Adobe" (
for /R "C:\Program Files (x86)\Adobe" %%X in (*.exe) do (
echo Blocking: %%~nX
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=out program="%%X" action=block
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=in program="%%X" action=block
)
)

if exist "C:\Program Files (x86)\Common Files\Adobe" (
for /R "C:\Program Files (x86)\Common Files\Adobe" %%X in (*.exe) do (
echo Blocking: %%~nX
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=out program="%%X" action=block
netsh advfirewall firewall add rule name="%%~nX adobe-block" dir=in program="%%X" action=block
)
)

echo Blocking completed.
pause
endlocal`

@Victory61
Copy link

Ciao, qualcuno ha lo script di sblocco, per favore
Example of unlocking Adobe products:

@echo off
:: ---------------------Total unlock all Adobe products --------------------------------
echo.
echo Total Unlock All Adobe Products
echo.
echo Elimination of existing firewall rules...
for /f "tokens=*" %%r in ('powershell -command "(Get-NetFirewallRule | where {$_.DisplayName -like '*adobe-block'}).DisplayName"') do (
netsh advfirewall firewall delete rule name="%%r"
)
echo Firewall rules were successfully eliminated.
echo.
pause
exit

@karinzaa
Copy link

In C:\ProgramData\Adobe No need to block?
image

@roggerwilliam
Copy link

In C:\ProgramData\Adobe No need to block? image

This folder does not contain .exe files

@karinzaa
Copy link

I has exe file in C:\ProgramData\Adobe\ARM\{291AA914-A987-4CE9-BD63-0C0A92D435E5}
image
and all in this folder C:\ProgramData\Adobe\ARM\S
image
image

@Paranoid84
Copy link

Dear,

only a quick question: I opened the .bat file (not as administrator) and the result is that, for each line, the system told me
"Elevation of privileges (Run as administrator) is required for the requested operation.".

But at the end the last sentence was:

"BLOCKING COMPLETED".

So...I don't understand if the .bat file create or not the rules...
How can I check it?

In addition, if i want to restore back the rules..how can I do?
Please help me..
thanks
File bat

@hannemaster
Copy link

hannemaster commented Jul 19, 2024

Dear,

only a quick question: I opened the .bat file (not as administrator) and the result is that, for each line, the system told me "Elevation of privileges (Run as administrator) is required for the requested operation.".

But at the end the last sentence was:

"BLOCKING COMPLETED".

So...I don't understand if the .bat file create or not the rules... How can I check it?

In addition, if i want to restore back the rules..how can I do? Please help me.. thanks

Even if it says "Blocking complete" it only means it got to the end of the script. No changes are made if you did not run it as Admin.

@Paranoid84
Copy link

Dear,
only a quick question: I opened the .bat file (not as administrator) and the result is that, for each line, the system told me "Elevation of privileges (Run as administrator) is required for the requested operation.".
But at the end the last sentence was:
"BLOCKING COMPLETED".
So...I don't understand if the .bat file create or not the rules... How can I check it?
In addition, if i want to restore back the rules..how can I do? Please help me.. thanks

Even if it says "Blocking complete" it only means it got to the end of the script. No changes are made if you did not run it as Admin.

Thank You so much!!
Could You kindly tell me how can I check if I "added" these blocks or not?
Have I to open the notepad and the file C:\Windows\System32\Drivers\etc\hosts, right?
For the moment, what I see is this

host

so, did i do something or not?
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment