import wmi
c = wmi.WMI()
for service in c.Win32_Service(Name="seclogon"):
result, = service.StopService()
if result == 0:
print "Service", service.Name, "stopped"
else:
print "Some problem"
break
else:
print "Service not found"
但是在編譯時,發(fā)生錯誤:
AttributeError: 'module' object has no attribute 'WMI'