Const HKEY_LOCAL_MACHINE = &H80000002
Public WShell
strComputer = "."
Set WShell = Wscript.CreateObject("Wscript.Shell" )
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv" )
strKeyPath = "SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
If subkey <> "Descriptions" Then
Wscript.Echo strKeyPath & "\" & subkey & "\" & "Connection"
strValueName = "MediaSubType"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & subkey & "\" & "Connection" ,strValueName,dwvalue
strValueName = "Name"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & subkey & "\" & "Connection" ,strValueName,strValue
Wscript.Echo "Card: " & strValue
If dwvalue = 2 Then
strValueName = "Name"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & subkey & "\" & "Connection" ,strValueName,strValue
Wscript.Echo "This is a wireless card will be disabled: " & strValue
strValueName = "PnpInstanceID"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & subkey & "\" & "Connection" ,strValueName,strValue
wShell.Run "devcon disable ""@" & strValue & """" ,2,true
End If
End If
Next |