Jump to content
Sign in to follow this  
myk3

devcon enable / disable stuff

Recommended Posts

myk3

We needed a way to disable "Wifi / Bluetooth / and Webcams" this uses devcon.. works well.. I am not sure if it will catch all the bluetooth / wifi cards but i will modify as I find more it will not work on..

EDIT: after a little more testing we had to add a few more switches to weed out LAN cards and add more to the cameras..

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=disable stuff.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Constants.au3>
#include <array.au3>


Global $line

fileinstall("C:\devcon.exe",@tempdir & "\")

Local $foo = Run(@Comspec & " /c " & @TempDir &'\devcon.exe find *usb* | find /I "cam"', @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
_disable()

$line = ""
Local $foo = Run(@Comspec & " /c " & @TempDir &'\devcon.exe find *usb* | find "Bluetooth"', @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
_disable()

$line = ""
Local $foo = Run(@Comspec & " /c " & @TempDir &'\devcon.exe listclass net | find /I "PCI" | find /I /V "gbe" | find /I /V "Gigabit"', @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
_disable()

FileDelete(@TempDir &"\devcon.exe")

func _disable()
While 1
$line &= StdoutRead($foo)
If @error Then ExitLoop
If $line <> "" Then Exitloop
Wend
$devArray = StringRegExp($line , "DEV_\w\w\w\w" , 3)
if IsArray($devArray) then
for $i = 0 to ubound ($devArray) - 1
runwait(@TempDir &"\devcon.exe disable *" & $devArray[$i],@SystemDir, @SW_HIDE)
next
endif
$devArray = StringRegExp($line , "PID_\w\w\w\w" , 3)
if IsArray($devArray) then
for $i = 0 to ubound ($devArray) - 1
runwait(@TempDir &"\devcon.exe disable *" & $devArray[$i],@SystemDir, @SW_HIDE)
Next
Endif
EndFunc
Edited by myk3

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×