Run section of vbscript code with elevated privilages
Posted on 2006-04-12
Hope this is in the right topic area, couldn't see one dedicated to vbscript. I've been asked to add the following code to our logon script to disable microsoft firewall on all clients.
Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
objPolicy.FirewallEnabled = FALSE
This code runs fine as an administrator but users unsuprisingly get a permission denied error. My question is this, can I run these 3 lines of code as an administrator? I want all other code in the script to run as the logged in user.