Question Need help with some NetSH concepts...

jumper77

Member
Joined
Jan 23, 2019
Messages
15
Location
Jackson Tennessee
Programming Experience
Beginner
It seems like this is the place to put this question. If I'm wrong, I'm sure someone will let me know :)
I've been working with NetSH.exe for the last few days and playing with all the Firewall commands. However most of them are not working right now. I'm sure I'm missing something pretty fundamental about this command line tool. I use a vbScript file elevated to admin to do the commands (you have to for the commands to work). This will be my second attempt at writing this. The first time something from the website didn't like me posting vbScript code and removed all my text, lol. But I'm going to try again anyway... And again the IPS got me. I'll just put in the NetSH commands and hope that's enough for everyone to understand.
VB.NET:
"%comspec% /c ""netsh advfirewall set allprofiles state off & pause"" ", 1, True

So NetSH returns "OK." when the command is correct, but nothing happens. I've noticed that there is a "Set" command, but so far haven't been able to get it to work (that's what I'm working on now). I'm wondering if you have to use a "Set" command after the original NetSH command??? But since I've been working on this all day as it is, I thought I would just go ahead ask for help. Even though I've been at this for a few days, I still feel like I know very little about all this.

If you need more info.... just ask.
And thanks in advance!!!
 
Why not use the Process class? The app must also run as admin of course. This works fine for me:
Visual Basic:
Process.Start("netsh", "advfirewall set allprofiles state off")
 
Back
Top