Back to Folder
ID | 32c71ef8-ac13-4289-92e6-6f888338506b |
Filename |
ISTA_firewall_rules.bat
|
Size | 3.96 KB |
Uploaded | 2025-02-05 19:06:30 |
Downloads | 8 |
MIME Type | text/x-msdos-batch |
Hashes |
- CRC32: 2396323a
- MD5: d5603fd5f5b0f2ba153815851e23d309
- SHA1: 775023cf29ce62f19b24b7802053e228c0c9b5d5
- SHA256: 1597705d7c166cd46f51f09bdd99231ee462b09e803cbbaa7ed190393f785840
|
Download file
Preview (text)
@echo off
::========================================================================================================================================
:: Elevate script as admin
set "batf_=%~f0"
set "batp_=%batf_:'=''%"
%_null% reg query HKU\S-1-5-19 && (
goto :_Passed
) || (
if defined _elev goto :_E_Admin
)
set "_vbsf=%temp%\admin.vbs"
set _PSarg="""%~f0""" -el
setlocal EnableDelayedExpansion
(
echo Set strArg=WScript.Arguments.Named
echo Set strRdlproc = CreateObject^("WScript.Shell"^).Exec^("rundll32 kernel32,Sleep"^)
echo With GetObject^("winmgmts:\\.\root\CIMV2:Win32_Process.Handle='" ^& strRdlproc.ProcessId ^& "'"^)
echo With GetObject^("winmgmts:\\.\root\CIMV2:Win32_Process.Handle='" ^& .ParentProcessId ^& "'"^)
echo If InStr ^(.CommandLine, WScript.ScriptName^) ^<^> 0 Then
echo strLine = Mid^(.CommandLine, InStr^(.CommandLine , "/File:"^) + Len^(strArg^("File"^)^) + 8^)
echo End If
echo End With
echo .Terminate
echo End With
echo CreateObject^("Shell.Application"^).ShellExecute "cmd.exe", "/c " ^& chr^(34^) ^& chr^(34^) ^& strArg^("File"^) ^& chr^(34^) ^& strLine ^& chr^(34^), "", "runas", 1
)>"!_vbsf!"
(%_null% cscript //NoLogo "!_vbsf!" /File:"!batf_!" -el) && (
del /f /q "!_vbsf!"
exit /b
) || (
del /f /q "!_vbsf!"
%_null% %_psc% "start cmd.exe -arg '/c \"!_PSarg:'=''!\"' -verb runas" && (
exit /b
) || (
goto :_E_Admin
)
)
exit /b
:_E_Admin
%ErrLine%
echo This script require administrator privileges.
echo To do so, right click on this script and select 'Run as administrator'.
goto _End
:_Passed
cls
::========================================================================================================================================
SET "APPDIR="
SET /P "APPDIR=Set ISTA Installdir, or leave empty for standard [C:\EC-APPS\ISTA]: " || SET "APPDIR=C:\EC-APPS\ISTA"
::remove old, if already exist
netsh advfirewall firewall delete rule name="ISTAGUI" dir=in program="%APPDIR%\TesterGUI\bin\Release\ISTAGUI.exe"
netsh advfirewall firewall delete rule name="ISTAOperation" dir=in program="%APPDIR%\TesterGUI\bin\Release\IstaOperation.exe"
netsh advfirewall firewall delete rule name="ISTAPsdzHostx86" dir=in program="%APPDIR%\PSdZ\host\PsdzServiceHost.exe"
netsh advfirewall firewall delete rule name="ISTAPsdzHostx64" dir=in program="%APPDIR%\PSdZ\hostx64\PsdzServiceHost.exe"
netsh advfirewall firewall delete rule name="ISTAServicesHost" dir=in program="%APPDIR%\TesterGUI\bin\Release\IstaServicesHost.exe"
netsh advfirewall firewall delete rule name="ISTAFSCHost" dir=in program="%APPDIR%\FSCValidHost\FscValidationHost.exe"
netsh advfirewall firewall delete rule name="IVM.Native.SLP.TCP" dir=in protocol=TCP localport=427 remoteip=LocalSubnet
netsh advfirewall firewall delete rule name="IVM.Native.SLP.UDP" dir=in protocol=UDP localport=427 remoteip=LocalSubnet
::add new
netsh advfirewall firewall add rule name="ISTAGUI" dir=in action=allow program="%APPDIR%\TesterGUI\bin\Release\ISTAGUI.exe" enable=yes
netsh advfirewall firewall add rule name="ISTAOperation" dir=in action=allow program="%APPDIR%\TesterGUI\bin\Release\IstaOperation.exe" enable=yes
netsh advfirewall firewall add rule name="ISTAPsdzHostx86" dir=in action=allow program="%APPDIR%\PSdZ\host\PsdzServiceHost.exe" enable=yes
netsh advfirewall firewall add rule name="ISTAPsdzHostx64" dir=in action=allow program="%APPDIR%\PSdZ\hostx64\PsdzServiceHost.exe" enable=yes
netsh advfirewall firewall add rule name="ISTAServicesHost" dir=in action=allow program="%APPDIR%\TesterGUI\bin\Release\IstaServicesHost.exe" enable=yes
netsh advfirewall firewall add rule name="ISTAFSCHost" dir=in action=allow program="%APPDIR%\FSCValidHost\FscValidationHost.exe" enable=yes
netsh advfirewall firewall add rule name="IVM.Native.SLP.TCP" dir=in action=allow protocol=TCP localport=427 remoteip=LocalSubnet enable=yes
netsh advfirewall firewall add rule name="IVM.Native.SLP.UDP" dir=in action=allow protocol=UDP localport=427 remoteip=LocalSubnet enable=yes
:_End