' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
' Disable Wireless Network Cards ( => MediaSubType=2 )
' note,
' You can not run this script as user Logon-script - unless
' the current user is a member of the local group Administrators.
' Therefore it is better you run this script as computer Startup-script.
'
' you can store Devcon.exe on a networkshare,
' in that case, replace the line with:
' oWShell.Run """\\server\share\devcon.exe"" disable ""@" & strValue & """" ,2,true
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
Const HKEY_LOCAL_MACHINE = &H80000002
Public oWShell, oReg
strComputer = "."
Set oWShell = Wscript.CreateObject("Wscript.Shell")
Set oReg=GetObject("winmgmts:{impersonationLevel=imper sonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = _
"SYSTEM\CurrentControlSet\Control\Network"
EnumeratingSubkeys HKEY_LOCAL_MACHINE, strKeyPath
Wscript.quit
Sub EnumeratingSubkeys(HKEY_LOCAL_MACHINE, strKeyPath)
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys
If IsArray(arrSubkeys) Then
For Each strSubkey In arrSubkeys
If Instr(subkey, "{4D36E972") = 0 Then
EnumeratingSubkeys HKEY_LOCAL_MACHINE,_
strKeyPath & "\" & strSubkey
End If
If subkey <> "Descriptions" Then
strValueName = "MediaSubType"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,_
strKeyPath & "\" & subkey & "\" & "Connection" ,_
strValueName,dwvalue
If dwvalue = 2 Then
strValueName = "PnpInstanceID"
oReg.GetStringValue HKEY_LOCAL_MACHINE,_
strKeyPath & "\" & subkey & "\" & "Connection" ,_
strValueName,strValue
oWShell.Run "devcon.exe disable ""@" & strValue & """" ,2,true
End If
End If
Next
End If
End Sub
\Rems
EDIT
note!
If you add the name of a remote computer for "strComputer", the script will EnumeratingSubkeys on the remote computer...
BUT - devcon.exe however will be executed by this script on your local computer!!!!!!!!! and not on the remote computer.