Disabling Wireless Driver

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Randy Snyder (aggie07_at_austin.rr.com)
Date: 01/25/05


Date: Tue, 25 Jan 2005 01:29:12 GMT

I am trying to disable the wireless driver on notebooks. Below is the
script that I have been working with. From the MSDN documentation, the
Win32_Service is used to stop device drivers; however, I am not having
much luck getting this to work. Does anyone have any ideas?

8<-----------------------------------------

Dim sComputer : sComputer = "."
Dim sServiceName, ReturnCode, Result

Set objWMIService = GetObject("winmgmts:\\" & sComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from
Win32_NetworkAdapter",,48)

For Each objItem in colItems
   Result = Instr(1, Lcase(objItem.NetConnectionID), "wireless", 1)
   If Result > 0 Then
     sServiceName = objItem.ServiceName
   End If
Next

Set WshShell = Wscript.CreateObject("WScript.Shell")
Set Locator = CreateObject("WbemScripting.SWbemLocator")
Set Services = Locator.ConnectServer(sComputer)
Set ServiceObject = Services.Get("Win32_Service='" & sServiceName & "'")
ReturnCode = ServiceObject.StopService

Wscript.Echo ReturnCode
Wscript.Quit

8<-----------------------------------------