WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: pennym on January 17, 2014, 02:36:51 AM

Title: disable webcam
Post by: pennym on January 17, 2014, 02:36:51 AM
dear all
How can i disbale a webcam with winbatch

perry
Title: Re: disable webcam
Post by: td on January 17, 2014, 07:48:02 AM
Assuming that you are referring to an integrated web cam, take a look at the 'Start' value under the registry key 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbvideo'.  If the web cam is currently enabled, the value of the value should be 3.  Setting that value to 4 should in theory disabled your web cam.  The WinBatch registry functions can be used to make this change but use extreme caution when fiddling with the registry.  I would test the key using regedit.exe to manually make the change and if that works,  create a script to perform the same task.

The change may require a reboot or perhaps an IntControl 59 to take effect.
Title: Re: disable webcam
Post by: pennym on January 19, 2014, 03:22:00 AM
Is is not working, i do not no why

P.



;CHECK CAMERA IS ENABLED
root = @REGMACHINE
subkey = "SYSTEM\CurrentControlSet\Services\usbvideo[Start]"
If RegExistValue(root, subkey)

   value = RegQueryValue(root, subkey)
   Message("start =", value)
Else
   Message("Notice: Subkey Not Found", subkey)
   exit
EndIf

;DISBALE CAMERA


regset=RegSetDword(@REGMACHINE, "SYSTEM\CurrentControlSet\Services\usbvideo[Start]",4,1)
Message("RegSet",regset)


IntControl(59, -1,"", 0, 0)


Title: Re: disable webcam
Post by: Deana on January 20, 2014, 04:25:50 PM
Did you happen to try this first manually as suggested by Tony? Does a reboot have any effect? If it doesn't work manually changing the registry value then you will need to find the method that does work for your webcam then reproduce that with your script.
Title: Re: disable webcam
Post by: td on January 21, 2014, 06:48:03 AM
Quote from: perrym on January 19, 2014, 03:22:00 AM
Is is not working, i do not no why

P.



;CHECK CAMERA IS ENABLED
root = @REGMACHINE
subkey = "SYSTEM\CurrentControlSet\Services\usbvideo[Start]"
If RegExistValue(root, subkey)

   value = RegQueryValue(root, subkey)
   Message("start =", value)
Else
   Message("Notice: Subkey Not Found", subkey)
   exit
EndIf

;DISBALE CAMERA


regset=RegSetDword(@REGMACHINE, "SYSTEM\CurrentControlSet\Services\usbvideo[Start]",4,1)
Message("RegSet",regset)


IntControl(59, -1,"", 0, 0)

My notebook computer requires a restart to have the changed registry value take effect.
Title: Re: disable webcam
Post by: pennym on January 21, 2014, 10:13:50 AM
Is there a way to do this without a reboot.

pm
Title: Re: disable webcam
Post by: Deana on January 21, 2014, 10:26:00 AM
Quote from: perrym on January 21, 2014, 10:13:50 AM
Is there a way to do this without a reboot.

pm

That depends on the device. You might also want to look into using Devcon to disable the device: http://msdn.microsoft.com/en-us/library/windows/hardware/ff544707(v=vs.85).aspx

See also:
http://support.microsoft.com/kb/311272
http://www.classicshell.net/forum/viewtopic.php?f=5&t=423