Disable Windows Firewall with VBS/Batch script

This is a simple VBS script to disable the specified computers' windows firewall using WMI, requires administrator access.

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colServiceList = objWMIService.ExecQuery _
    ("Select * from Win32_Service where Name = 'SharedAccess'")

For Each objService in colServiceList
    If objService.State = "Running" Then
        Wscript.Sleep 5000
    End If
    errReturnCode = objService.ChangeStartMode("Disabled")   

And if you can do it in VBS, you can do it in batch script!

No comments:

Post a Comment