Jump to content
skon2464

Adding Firewall rule

Recommended Posts

skon2464

I am trying to add a firewall rule but I think I got the syntax wrong. 

Run(@ComSpec & "/k " & 'netsh advfirewall firewall add rule name=' & '"New"' & 'dir=in action=allow program=' & NoSlash(@ScriptDir) & '"\MyApp.exe"' & 'enable=yes')

Could you please let me know what I missed.

Edited by skon2464

Share this post


Link to post
Share on other sites
FireFox

Hi,

Welcome to the autoit forum :)

I don't know about the syntax, but I advice you to take a look at this topic : '?do=embed' frameborder='0' data-embedContent>>

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
DW1

The syntax issue is likely to do with your lack of spaces between parameters.  Also, you messed up on quoting the app name, not including the path.

-Added space before "dir="

-Added space before "enable="

-Moved double quote from before "MyApp.exe" to right after "program="

Run(@ComSpec & "/k " & 'netsh advfirewall firewall add rule name=' & '"New"' & ' dir=in action=allow program="' & NoSlash(@ScriptDir) & '\MyApp.exe"' & ' enable=yes')

Share this post


Link to post
Share on other sites
skon2464

I am able to figure out the problem. Thanks guys

Share this post


Link to post
Share on other sites
Nareshm
On 7/22/2013 at 10:59 PM, DW1 said:

The syntax issue is likely to do with your lack of spaces between parameters.  Also, you messed up on quoting the app name, not including the path.

-Added space before "dir="

-Added space before "enable="

-Moved double quote from before "MyApp.exe" to right after "program="

 

Run(@ComSpec & "/k " & 'netsh advfirewall firewall add rule name=' & '"New"' & ' dir=in action=allow program="' & NoSlash(@ScriptDir) & '\MyApp.exe"' & ' enable=yes')

Not working

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×