View Full Version : how to say via a script a if a network is a wireless network ?
Pierre
November 9th 09, 03:58 PM
hi,
as in "my network places | properties", each kind of network have a
different icon (wireless, lan, vpn, etc), windows _knows_ how to
distinguish the networks type.
I would like to create a script (.WSF) which when run on a PC find all
wireless networks and disable them. do you have any idea on how to
list all wireless networks on a PC ?
TIA,
Pierre
Pegasus [MVP]
November 9th 09, 06:00 PM
"Pierre" > wrote in message
...
> hi,
>
> as in "my network places | properties", each kind of network have a
> different icon (wireless, lan, vpn, etc), windows _knows_ how to
> distinguish the networks type.
>
> I would like to create a script (.WSF) which when run on a PC find all
> wireless networks and disable them. do you have any idea on how to
> list all wireless networks on a PC ?
>
> TIA,
> Pierre
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. 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.
@echo off
set Scr=c:\TempVBS.vbs
set Ethernet=0
set Wireless=9
set VB=echo^>^>%Scr%
cd 1>nul 2>%Scr%
%VB% Set oWMIService = GetObject("winmgmts:\\.\root\CIMV2")
%VB% Set colItems = oWMIService.ExecQuery( _
%VB% "SELECT * FROM Win32_NetworkAdapter",,48)
%VB% For Each oItem In colItems
%VB% If Not IsNull(oItem.NetConnectionStatus) Then
%VB% WScript.Echo oItem.Name
%VB% If oItem.AdapterTypeId = %Ethernet% _
%VB% Then WScript.Echo "Ethernet adapter"
%VB% If oItem.AdapterTypeId = %Wireless% _
%VB% Then WScript.Echo "Wireless adapter"
%VB% wscript.echo
%VB% End If
%VB% Next
cscript //nologo %Scr%
del %Scr%
Pierre
November 9th 09, 10:49 PM
On Nov 9, 7:00*pm, "Pegasus [MVP]" > wrote:
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
Pierre
November 10th 09, 12:57 PM
when I run the script on my laptop I get this answer:
Broadcom NetXtreme 57xx Gigabit Controller
Ethernet adapter
Intel(R) PRO/Wireless 3945ABG Network Connection
Ethernet adapter
Carte réseau 1394
Ethernet adapter
where the wireless adapter is seen as regular ethernet adapter :(
I have to find another way...
thanks for your help.
Pegasus [MVP]
November 10th 09, 03:31 PM
"Pierre" > wrote in message
...
when I run the script on my laptop I get this answer:
Broadcom NetXtreme 57xx Gigabit Controller
Ethernet adapter
Intel(R) PRO/Wireless 3945ABG Network Connection
Ethernet adapter
Carte réseau 1394
Ethernet adapter
where the wireless adapter is seen as regular ethernet adapter :(
I have to find another way...
thanks for your help.
===========
This is exactly the problem I found. You can, of course, hard-code the
adapter names that you feed to devcon.exe but his is not really what you
asked for. Sorry . . .
Spamcop User
November 11th 09, 06:41 AM
Technet have a script centre you should also look through
http://technet.microsoft.com/en-us/scriptcenter/default.aspx
There is also a scripting newsgroup you should ask these questions in:
microsoft.public.scripting.vbscript
microsoft.public.scripting..wsh
--
SPAMCOP User
"Pegasus [MVP]" > wrote in message
...
>
> "Pierre" > wrote in message
> ...
> when I run the script on my laptop I get this answer:
>
> Broadcom NetXtreme 57xx Gigabit Controller
> Ethernet adapter
>
> Intel(R) PRO/Wireless 3945ABG Network Connection
> Ethernet adapter
>
> Carte réseau 1394
> Ethernet adapter
>
> where the wireless adapter is seen as regular ethernet adapter :(
> I have to find another way...
>
> thanks for your help.
>
> ===========
>
> This is exactly the problem I found. You can, of course, hard-code the
> adapter names that you feed to devcon.exe but his is not really what you
> asked for. Sorry . . .
>
Pegasus [MVP]
November 11th 09, 09:08 AM
"SPAMCOP User" > wrote in message
...
> Technet have a script centre you should also look through
>
> http://technet.microsoft.com/en-us/scriptcenter/default.aspx
>
> There is also a scripting newsgroup you should ask these questions in:
>
> microsoft.public.scripting.vbscript
> microsoft.public.scripting..wsh
>
> --
> SPAMCOP User
Yes, I am fully aware of them.
vBulletin® v3.6.4, Copyright ©2000-2024, Jelsoft Enterprises Ltd.