netsh ipsec static add filter filterlist
<p>I've setup a basic index.asp page that allows me to input an IP address then triggers a batch file which adds that IP to the local security policy filter list. the command my bat file runs:</p>

<pre><code>netsh ipsec static add filter filterlist="Blocked IPs" srcaddr=%1 dstaddr=any
</code></pre>

<p>If I trigger the batch file manually from the command line it works fine and the IP is added. However if I trigger it from the webpage nothing is added to the filter list...I tested by adding "mkdir c:\%1" as the first line in the batch file and it successfully made a folder named with the IP address so I have verified that its properly getting triggered and receiving the variable. Another thing I noticed if I use the same command but specify a remote computer it works.</p>

<pre><code>netsh -r servername -u username -p password ipsec static add filter filterlist="Blocked IPs" srcaddr=%1 dstaddr=any
</code></pre>

<p>It will apply it to the remote computer's filterlist, so I tried just pointing back to localhost or even the local server name &amp; IP but no difference.</p>

<p>Here is the code for the .asp page</p>

<pre><code>&lt;%
      if (Request.QueryString("ipaddress") &lt;&gt; "") then
      Response.Write ("start")

      Dim wshell, intReturn
      set wshell = server.createobject("wscript.shell")
      intReturn = wshell.run("C:\inetpub\test.bat " &amp; Request.QueryString("ipaddress"), 0, True)
      Response.Write( intReturn )
      set wshell = nothing
                              response.write Request.querystring("ipaddress")                                  
      Response.Write ("end")
      else
%&gt;
&lt;html&gt;
      &lt;head&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;/head&gt;
       &lt;body&gt;
       &lt;center&gt;
       &lt;form action="index.asp" method="get"&gt;
       &lt;br/&gt;
            &lt;input name="ipaddress" type="text"&gt;
      &lt;br/&gt;&lt;br/&gt;
            &lt;input type="submit"&gt;
       &lt;form&gt;
       &lt;/center&gt;
       &lt;/body&gt;
&lt;/html&gt;
&lt;% end if %&gt;
</code></pre>