locked
VBScript to Disable a Firewall RRS feed

  • Question

  • We run a logon script for our users that takes care of some of our policies we like to enforce.  One of those being that the firewall should be disabled.  This script worked fine on XP and we are now testing to upgrade to Windows 7.  However these lines of code throw the error that follows:

    Set objFirewall = CreateObject("HNetCfg.FwMgr")     ' <---Specifically this one
    Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
    objPolicy.FirewallEnabled = FALSE

     

    Windows Security Alert

    A program or firewall is not compatible with this version of Windows

    If the program is a firewall, it might not be adequately protecting your computer.  Uninstall your firewall, but to make your computer more secure, keep Windows Firewall turned on until you install a firewall that is compatible with this version of Windows.

    Contact the manufacturer of the program or firewall listed below to get a version that is compatible with this version of Windows.

    Name:     Microsoft Windows Based Script Host
    Publisher:  Microsoft Corporation
    Path:  C:\WIndows\System32\WScript.exe

     

    The other weird thing is I noticed I only get this message if I am an administrator on the PC even though we are pushing this through AD.  So does anyone know why this code will not work with Windows 7 and if so is there another way of accomplishing this with a vbscript that won't give us an error?  Secondly but not nearly as important why would this only throw this message when the user is an Admin?  It should be running either way since it is pushed through AD.

    Tuesday, June 29, 2010 1:44 PM

Answers

  • For script related questions, please discuss in Script Center forum.

    The Official Scripting Guys Forum


    Arthur Xie - MSFT
    • Marked as answer by Arthur Xie Monday, July 5, 2010 8:24 AM
    Wednesday, June 30, 2010 8:27 AM
  • Hi

    I sugest that you do this using a GPO instead of VB script.

     

     


    Best Regards Chris Steding MCTS Windows 7 Configuration www.compit.se
    • Marked as answer by Arthur Xie Monday, July 5, 2010 8:24 AM
    Thursday, July 1, 2010 7:43 AM

All replies

  • For script related questions, please discuss in Script Center forum.

    The Official Scripting Guys Forum


    Arthur Xie - MSFT
    • Marked as answer by Arthur Xie Monday, July 5, 2010 8:24 AM
    Wednesday, June 30, 2010 8:27 AM
  • I guess I would consider this more a Windows 7 compatibility question since it works in another OS but that is fine.
    Wednesday, June 30, 2010 1:04 PM
  • Hi

    I sugest that you do this using a GPO instead of VB script.

     

     


    Best Regards Chris Steding MCTS Windows 7 Configuration www.compit.se
    • Marked as answer by Arthur Xie Monday, July 5, 2010 8:24 AM
    Thursday, July 1, 2010 7:43 AM