-
-
Save ph33nx/0ed14724213c4cc467c85826c9dca908 to your computer and use it in GitHub Desktop.
@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 |
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.
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.. thanksEven 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
so, did i do something or not?
thanks
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?
![File bat](https://private-user-images.githubusercontent.com/176017924/350312961-1d409695-0097-49c5-af94-557bbfa62c3c.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE2MDQzNzksIm5iZiI6MTcyMTYwNDA3OSwicGF0aCI6Ii8xNzYwMTc5MjQvMzUwMzEyOTYxLTFkNDA5Njk1LTAwOTctNDljNS1hZjk0LTU1N2JiZmE2MmMzYy5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzIxJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyMVQyMzIxMTlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hYzM1OTdjYjhjZjExNGIzMmQ1ZWNlZGYzOWQ0OWNiNzk5YzUwN2E2ODhjYzdlZTYwZWYxZjU4MWVkZDY4Mjk3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.KotIatYP3V6eZgWXNf062iegXqgYWaBObo-fsSgXs-A)
Please help me..
thanks