How can I declare the wmi_filter option? Can it be as below?
Code : Tout sélectionner
wmi_info(keys=['Win32_NetworkAdapter'])['name']['index']
Code : Tout sélectionner
wmi_info(keys=['Win32_NetworkAdapter'])['name']['index']
wmi_info gives out a data structure out of wmi module. You can just print the data structure or its inner parts:empbilly a écrit : ↑23 mars 2018 - 17:56 Hi folks,
How can I declare the wmi_filter option? Can it be as below?
Code : Tout sélectionner
wmi_info(keys=['Win32_NetworkAdapter'])['name']['index']
Code : Tout sélectionner
wmi_data = wmi_info(keys=['Win32_NetworkAdapter'])['Win32_NetworkAdapter']
print wmi_data
print(wmi_data[0].keys())
for item in wmi_data:
print item['Caption']
wmi_info() just give out a python list/dict datastructure with information for inventory. You cannot do any action out of that wmi_info() function. However you can import wmi python module and use it in your script.
Code : Tout sélectionner
netsh interface set interface "network_adapter_name" admin=disable
Code : Tout sélectionner
# -*- coding: utf-8 -*-
from setuphelpers import *
import subprocess
uninstallkey = []
con = 'Conexão local 2'
def install():
print "Instalando Wi-fi adapter disable"
try:
x = subprocess.Popen(["cmd.exe", "/c", "wmic path win32_networkadapter where NetConnectionID='%s' call disable" % (con)], stdout=subprocess.PIPE, shell=True)
print (x.stdout.read())
except (RuntimeError, TypeError, NameError):
print "Erro na execução do cmd.exe"
Code : Tout sélectionner
# -*- coding: UTF-8 -*-
from setuphelpers import *
import subprocess
import locale
uninstallkey = []
con = u'Conexão de Rede sem Fio'
def install():
print u"Exercutando Wi-fi card disable"
try:
x = subprocess.Popen(["cmd.exe", "/c", "wmic path win32_networkadapter where NetConnectionID='%s' call disable" % (con.encode(locale.getpreferredencoding()))], stdout=subprocess.PIPE, shell=True)
print (x.stdout.read())
except (RuntimeError, TypeError, NameError):
print u"Erro na execução do cmd.exe"
Yes. I live in Brazil and work in an education institution.I see portuguese comments in your script to disable wifi connexions, are you writing from Brazil ?
If that's the case, that would be just cool to start having WAPT in South America.
I think it would be great to have, mainly, the wapt documentation in Portuguese. Speaking of the sysadmins of our institution as a whole, more or less about 20 campus, the vast majority do not have an intermediary to advanced skills in English.If your language is Portuguese, do you feel it would be useful to have WAPT internationalized in Portuguese, or do you feel that adminsys are sufficiently familiar with English where you live ?