[python-win32] How to disable Windows Firewall using WMI
prashant padaganur
prashantpadaganur at gmail.com
Mon Jul 9 07:16:30 CEST 2012
>>On 06/07/2012 14:36, prashant padaganur wrote:
>>* Thanks. But does not help still. I am getting the same com error. *>
><code>
>import wmi
>
>c = wmi.WMI(namespace="root/Microsoft/HomeNet")
>for whatever in c.HNet_ConnectionProperties():
> print whatever
>
>
></code>
>
>I'm not in a position to try it, but I don't imagine you want
>the quotes round "False" (that's a string; you want the boolean).
>And you certainly don't need the Put_ -- the wmi module does that for
>you. (It has to justify its existence somehow; it doesn't do much else!)
>
>TJG
Thanks TJG. It works now. I am able to read/write
Hnet_ConnectionProperties(). But I still need to use object.Put_().
But the problem is that when I check from the control panel the actual
disabling of Firewall is not happening.
I want to do the equivalent of "netsh firewall set opmode mode=disable
profile=ALL"
<Code>
c = wmi.WMI(namespace="root/Microsoft/HomeNet")
for domain in c.HNet_ConnectionProperties():
print domain
domain.IsFirewalled = False
domain.IsIcsPrivate = False
domain.IsIcsPublic = False
domain.Put_()
print "After disabling"
print domain
</Code>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20120709/624738f8/attachment.html>
More information about the python-win32
mailing list