Freitag, 8. August 2008 21:54
I'm having issues with a script I'm working on. The end goal is to disable all wireless adapters on all machines via a WMI script.
I'm using the Enable/Disable methods for the Win32_NetworkAdapter Class.
I have written different scripts that simply disable all NICs. It actually disabled them ALL, EXCEPT the wireless NIC i'm trying to. The same script posted below, but searching for "Broadcom" instead of "wireless" works fine on the wired connections as well
The script below successfully finds all the wireless adapters and echos them. Yet, it simply doesn't disable the NIC.
Here is my favorite part. If I manually disable the adapter, and change it to "objItem.Enable" to turn it on, it works beautifully.
I haven't had a chance to test against any other cards to determine if this is an isolated issue to this specific wireless nic.
strComputer = "."
intCount = 0
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter")
For Each objItem in colItems
strWirelessDescription = objItem.Description
If InStr(strWirelessDescription, "Wireless") <> 0 Then
intCount = intCount + 1
Montag, 11. August 2008 13:08
Any suggestions at all?
Should I look into a new driver or something? I'm not sure at what level WMI methods come into play with hardware.
Donnerstag, 5. April 2012 04:50
I don't know if this helps you, but I *THOUGHT* I had the same problem. Turns out the problem was that the code needs to be run elevated (eg. to debug this I had to start visual studio as administrator).
So just to check, are you sure your script/prog is running from elevated command prompt/whatever you are starting it from?
EDIT: Well if you did manage to disable some adapters I would think you have rights to disable all of them... So I don't think this is a solution to that.