Because of the Java 7 firewall problem, I am trying to execute the following command as administrator but I get an error:

netsh advfirewall set global StatefulFTP disable

(German) "Der folgende Befehl wurde nicht gefunden: advfirewall"

In English, something like:

"The following command was not found: advfirewall"

I found a related problem, but I am not running Windows 64bit; I am using Windows Vista Business SP2 32bit.

A workaround is to disable the firewall, but that is not a good solution.

According to the Sun bug report, it is possible to change the firewall setting over the registry but I don't know how.

Any ideas?

Update

In the Microsoft documentation about netsh I found an article describing my error message. It explains that depending on the installation different contexts are available. I don't have the "netsh advfirewall" context on two different computers.


Solution 1:

You may have an unregistered or missing helper dll within netsh

Run netsh show helper from and administrator command prompt and scan the output for the advfirewall context. If it is missing, run netsh add helper AUTHFWCFG.DLL to restore it.


Full list of netsh helpers (contexts) you may want to register

advfirewall: netsh add helper AUTHFWCFG.DLL
firewall: netsh add helper FWCFG.DLL
http: netsh add helper NSHHTTP.DLL
interface: netsh add helper IFMON.DLL
bridge: netsh add helper HNETMON.DLL
dhcpclient: netsh add helper DHCPCMONITOR.DLL
dnsclient, netio: netsh add helper NETIOHLP.DLL
ipsec: netsh add helper NSHIPSEC.DLL
lan: netsh add helper DOT3CFG.DLL
mbn: netsh add helper WWANCFG.DLL
namespace: netsh add helper NETIOHLP.DLL
nap: netsh add helper NAPMONTR.DLL
p2p: netsh add helper P2PNETSH.DLL
ras: netsh add helper RASMONTR.DLL
rpc: netsh add helper RPCNSH.DLL
trace: netsh add helper NETTRACE.DLL
wcn: netsh add helper WCNNETSH.DLL
wfp: netsh add helper NSHWFP.DLL
winhttp: netsh add helper WHHELPER.DLL
winsock: netsh add helper WSHELPER.DLL
wlan: netsh add helper WLANCFG.DLL

Solution 2:

You may need to run this with elevated privileges as administrator


How can I do that?

Use one of the following methods:

  • Open an Elevated Command Prompt in Six Keystrokes
    Press Win type cmd Ctrl+Shift+Enter and then hit Alt+C to confirm the elevation prompt.

  • Install an Elevation Container
    Download John Robbins' excellent program elevate.exe and place it in your path. Now you can call programs with elevated privileges using elevate <program> <program arguments> (or you can rename it sudo.exe and call them with sudo)

  • Scripting Elevation

Why is this necessary?

According to Netsh Commands for Windows Firewall with Advanced Security you must have the required permissions to run the netsh advfirewall commands.

  • If you are a member of the Administrators group, and User Account Control is enabled on your computer, then run the commands from a command prompt with elevated permissions. To start a command prompt with elevated permissions, find the icon or Start menu entry that you use to start a command prompt session, right-click it, and then click Run as administrator.

  • If you are a member of the Network Operators group then you can run the commands from any command prompt.

  • If you are a not a member of Administrators or Network Operators, and have not been delegated any other permissions to run this command, then you can run only those commands that display, but do not change settings.