In this post, we will show you how to find and disable webcams using PowerShell in Windows 11/10.
Webcams are typically small cameras that sit on a desk, attach to a user’s monitor, or are built into the hardware. Webcams can be used during a video chat session involving two or more people, with conversations that include live audio and video. If you find the webcam intrusive with your privacy, knowingly or unknowingly or you want to prevent webcam hacking attacks, you may want to outrightly disable the webcam.
Use PowerShell to find and disable Webcams
To use PowerShell to find and disable Webcams in Windows 11/10, do the following:
First, you’ll need to find the installed camera on your Windows computer. Here’s how:
- Press Windows key + X to open the Power User Menu.
- Press M key on the keyboard to open Device Manager.
- Once you’re inside Device Manager, scroll down through the list of installed devices and expand the Imaging devices or Cameras section.
- Right-click Integrated Camera or the primary webcam, and click Properties.
- Go to the Details tab.
- Under Property section, click to select Matching device ID from the drop-down.
- Right-click the value and select Copy. Then paste the value into Notepad.
Alternatively, you can use PowerShell to find the camera by running the command below. Substitute the <PRIMARY CAMERA> placeholder with the actual name of the camera as listed in Device Manager – in this example HP Webcam.
Get-CimInstance Win32_PnPEntity | where caption -match '<PRIMARY CAMERA>'
Now that you have the camera device ID, you can proceed to disable the webcam using the Devcon command as follows:
- Download and install Windows Driver Kit (WDK) for the appropriate architecture (32bit or 64bit) of the operating system.
Tip: The download page states that Visual Studio is required, but you can skip that step, and during the installation, you can skip the warning.
- Once you have downloaded and installed WDK to a location on your C drive, create and run a PowerShell script with the following parameters/values to disable the camera. Substitute the <FOLDER> placeholder with the actual name of the folder where your copy of Devcon is residing.
$id = (Get-CimInstance Win32_PnPEntity | where caption -match '<PRIMARY CAMERA>').pnpDeviceID $ppid = "{0}{1}" -f '@',$id Set-Location c:\<FOLDER> Devcon status $ppid Devcon disable $ppid Devcon status $ppid
Once the script executes, you can check and see the camera is now disabled in Device Manager.
- To enable the camera device, run the command below in PowerShell:
devcon enable $ppid
That’s it on how to use PowerShell to find and disable or enable Webcams in Windows 11/10!
Source: Microsoft.com.
Now read: Microsoft PowerShell Script Browser helps you find and use Script samples easily.