firewall script

G

Guest

I am using this script to enable/disable the Windows
firewall

Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile

objPolicy.FirewallEnabled = false

The script runs fine while logged on as admin, but fails
as a lower user! I believe it is because only admins can
enable/disable the firewall! Can I add something to the
script to make it work or can I Allow power users to
enable/disable the firewall!
 
T

Torgeir Bakken \(MVP\)

James said:
I am using this script to enable/disable the Windows
firewall

Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile

objPolicy.FirewallEnabled = false

The script runs fine while logged on as admin, but fails
as a lower user! I believe it is because only admins can
enable/disable the firewall! Can I add something to the
script to make it work or can I Allow power users to
enable/disable the firewall!
Hi

Yes, the script will only work when run under admin credentials.

You might get something to work using a Runas wrapper utility or
similar, take a look here:

http://groups.google.com/[email protected]

Another one that is not mentioned above:

LSrunas/LSrunasE (the latter with password encryption)
http://www.linkselection.com/lsrunas.asp


If this is an Active Directory domain, here is a better solution:

You can do it in a computer startup script that runs as part of
the boot up process (before the user logs in). It runs under the system
context and has admin rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top