General discussion

Locked

WSH disabling local network adapter in WinXP

By milosek_88 ·
Hi,

i would like to make a simple script with windows script host to disable / enable specific network adapter on local computer.
So far i can select the adapter and display some information about it, but i can't find out how to disable it. Running operating system is Windows XP Pro SP3. Any help would be greatly appreciated.

SCRIPT:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter where NetConnectionID = 'LAN1'")
For Each adapter in colNetAdapters
Wscript.Echo "Adapter name: " & adapter.NetConnectionID & " status: " & adapter.Availability
adapter.Availability = 8
'adapter.Disable
Wscript.Echo "Adapter name: " & adapter.NetConnectionID & " status: " & adapter.Availability
Next

This conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Back to Windows Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums