Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
objPolicy.FirewallEnabled = FALSE
This script does not work in Vista/2008 and Windows 7 anymore. Even with elevation.
The error box is shown "a program or firewall is not compatible with this version of windows"
For a simple command line \ batch file:
Or with PowerShell:
Both work fine under Windows Vista. If you are still having issues then I'd dig further to ensure that you have the right permissions and that you are using core windows components to execute the script. I have a parallel install of PowerShell (used by the VMWare VI Toolkit) that throws exactly the same security exception you list above when I try to use it to disable the firewall but for the basic Powershell v1.0 installation it works fine.
Found this myself:
http://msdn.microsoft.com/en-us/library/dd339606(VS.85).aspx