Results 1 to 4 of 4
Thread: NIC
Hybrid View
-
14th July 2011 15:08 #1Registered User
Join Date: Nov:2010
Location: zoofia
Posts: 9
NIC
,
VBS , . - .
. , - . ( ) + VBS .
- , . .
Win 2003 SP2/R2/Enterprise Win2008 SP2/R2 Standard Enterprise etc.
, , . . devicedisable.exe , .
----------
'######################Script for disconnecting NIC`s############
'Disable disconnected NICs by using the device disable utility for Windows x86 x64
'Prerequisite: devicedisable.exe
'author Jordan Radkov------------------------
'date '7/13/2011
'version 1.1 Excluded all popups and notifications so action can be performed in the background
'No notifications will appear even if no NICs are found and the result
'In the next line you have to define the physical location for devicedisable.exe
sDevcon = "C:\temp\NICScript\devicedisable.exe "
iEthernet = 0: iWireless = 9
Set oWshShell = CreateObject("WScript.Shell")
'Generate a list of all devices
Set oExec = oWshShell.Exec(sDevcon & " HWIDs *")
WScript.Sleep 5000
sResult = ""
While Not oExec.StdOut.AtEndOfStream
sResult = sResult & oExec.StdOut.ReadLine & "|"
Wend
aDeviceInfo = Split(sResult, "|")
'Check which adapters are disabled
Set oWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colItems = oWMIService.ExecQuery(_
"SELECT * FROM Win32_NetworkAdapter", , 48)
For Each oItem In colItems
If (oItem.AdapterTypeId = iEthernet _
Or oItem.AdapterTypeId = iWireless) _
And oItem.NetConnectionStatus = 7 _
Then DisableAdapter(oItem.Name)
Next
'Disable disconnected adapters
Sub DisableAdapter (sName)
For i = 0 To UBound(aDeviceInfo) - 1
If LTrim(aDeviceInfo(i)) = "Name: " & sName Then
Set oExec = oWshShell.Exec(sDevcon _
& " disable " & aDeviceInfo(i+2))
Do
WScript.Sleep 200
Loop Until oExec.Status = 1
End If
Next
End Sub
------
, . echo. , "Cable Unplugged" .
UAC . .Last edited by dann_radkov; 14th July 2011 at 15:11. Reason:
-
14th July 2011 19:45 #2
?
, devcon.exe?
?
?, , template Adwords , firewall-a , ... <template>
-
15th July 2011 09:32 #3Registered User
Join Date: Nov:2010
Location: zoofia
Posts: 9
-
19th July 2011 11:47 #4Registered User
Join Date: Nov:2010
Location: zoofia
Posts: 9




Reply With Quote

Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in