Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Disable a network adapter

Reply
 
Old 09-30-2009   #1 (permalink)
Jake


 
 

Disable a network adapter

Hi,

How can I disable or enable a network adapter called 'Local Connection
1' using a script?

Than for help on this

regards

jake

My System SpecsSystem Spec
Old 09-30-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: Disable a network adapter


"Jake" <jake44@newsgroup> wrote in message
news:eaCrLbZQKHA.5052@newsgroup
Quote:

> Hi,
>
> How can I disable or enable a network adapter called 'Local Connection 1'
> using a script?
>
> Than for help on this
>
> regards
>
> jake
Have a look here:
http://groups.google.com/group/micro...3fab1141c6c93e

IMHO this is a rather clumsy solution. An alternative is to invoke
devcon.exe from within your VB Script, which is not much better. The
cleanest solution is probably to run devcon.exe from within a batch file,
e.g. like so:

@echo off
goto Start
---------------------------------------------------
Disable a device from the Command Prompt
16.4.2006 FNL
---------------------------------------------------
:Start
setlocal enabledelayedexpansion
set Adapter=Broadcom NetXtreme Fast Ethernet

set HWID=x
set count=0
set found=no

devcon.exe 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 (
devcon disable "!HWID!"
) else (
echo Device "%Adapter%" not found.
)
del c:\device.txt

You can download devcon.exe from here:
http://download.microsoft.com/downlo...240/devcon.exe.


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Disable wireless network adapter when a laptop is docked? Vista General
Fails to connect to network on boot, have to reset network adapter Vista networking & sharing
Trouble getting Hyper-V Virtual Network to work with second Network Adapter Virtual Server
Disable security to use WFI adapter? Vista hardware & devices
Can't disable wireless network adapter in Device Manager Vista hardware & devices


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46