thanks for your answer
Unfortunately Windows does not always report wireless adapters correctly.
I
have a wireless PCMCIA adapter and Windows thinks that it is an ordinary
Ethernet adapter.
I plan to run it on laptops computer with on-board WiFi adapters.
Try the batch file below. It is a VB Script file
wrapped
up in a batch file. If you state a little more clearly what output you
expec
then I can adjust it to suit your requirements.
I'm not especially interested in any output, only in enabling or
disabling wireless adapters.
maybe oItem.Enable() and/or oItem.Disable() do the trick ?
Pierre
=====================
I have been looking for some time for a method based on WMI to
enable/disable a device, without success. Until I find one I have to use
devcon.exe as in the following batch file. You can get devcon.exe from here:
http://download.microsoft.com/download/1/1/f/11f7dd10-272d-4cd2-896f-9ce67f3e0240/devcon.exe
@echo off
goto Start
---------------------------------------------------
Enable or disable a device from the Command Prompt.
Prerequisite: d:\Tools\devcon.exe
16.4.2006 FNL
---------------------------------------------------
:Start
setlocal enabledelayedexpansion
set Adapter=Broadcom NetXtreme Fast Ethernet
if /i "%1"=="enable" goto go
if /i "%1"=="disable" goto go
echo Syntax: Device enable / disable
goto :eof
:go
set HWID=x
set count=0
set found=no
devcon hwids "PCI\*" > c:\device.txt
for /F "tokens=*" %%* in (c:\device.txt) do (
set /a count=!count! + 1
if /i "%%*"=="Name: %Adapter%" set found=yes& set count=1
if !found!==yes if !count!==3 set HWID=%%*
)
if %found%==yes (
echo HWID=!HWID!
devcon %1 "!HWID!"
) else (
echo Device "%Adapter%" not found.
)
endlocal
del c:\device.txt
You would need to adjust the line
set Adapter=Broadcom NetXtreme Fast Ethernet
to suit your own requirements. The adapter name "Broadcom NetXtreme Fast
Ethernet" comes directly from the VB Script that I posted in my first reply.