Script to Disable WiFi Device
An old script to share :-) Below is an example script that was once used to disable WiFi devices on desktop computers attached to the LAN, but that came with a built-in and enabled WiFi device.
'========================================================================== ' NAME: DisableWifi ' AUTHOR: Nick Moseley, Archstone ' COMMENT: Determines if a network adapter device is wireless/wifi and then ' executes a devcon command to disable the device. This should only target ' Vostro desktops where there is wireless adapter ' VERSION HISTORY: ' 1.0 (05/13/2011) - Initial Script ' 2.0 (05/25/2011) - Added logging into registry for future inventory '========================================================================== Option Explicit Const ForAppending = 8 Dim oWMI, oShell, colItems, oFSO, oFile Set oShell = CreateObject ("WScript.Shell") Set oWMI = GetObject ("winmgmts:\\.\root\cimv2") Set colItems = oWMI.ExecQuery ("Select * from Win32_PnPEntity where name like '%wireless%' or name like '%wifi %'") 'Start logging Set oFSO = CreateObject("Scripting.fileSystemObject") Set oFile = oFSO.OpenTextFile ("C:\Windows\Temp\DisableWifi.log", ForAppending, True) oFile.WriteLine "Disable wireless network adapter" oFile.WriteLine " => Started (" & Date & " " & Time & ")" ' If count=0 of the collection, then no wireless devices found If colItems.count=0 Then oFile.WriteLine " => WARNING: Wireless network adapter not found!" Else Dim oItem, sDeviceType oFSO.CopyFile oFSO.GetFile(Wscript.ScriptFullName).ParentFolder & "\devcon\i386\devcon.exe ", "C:\Windows\Temp\devcon.exe" ' Parse the collection of wireless devices to be disabled For Each oItem In colItems sDeviceType = UCase(Left(oItem.DeviceID, 3)) If sDeviceType = "PCI" Then oShell.Run "C:\Windows\Temp\devcon.exe disable ""@" & oItem.deviceID & "" oFile.WriteLine " => Disabled " & oItem.Name oFile.WriteLine " Device ID: " & oItem.DeviceID End If Next End If ' End oFile.WriteLine " => Completed (" & Date & " " & Time & ")" WScript.Quit (oFile.Close)