I am using following command to create firewall exception. The command is being run through a batch file, called from my vb.net project.
netsh advfirewall firewall add rule name="SQL Server Windows NT"; dir=in action=allow program=" allowedprogram "C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\ sqlservr.exe"; enable=yes
The required operation required requires elevation <Run as administrator>.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)