On Windows, you can look in Device Manager to check whether camera devices exist. This check can also be performed using PowerShell or Command Prompt, without special rights.
Command Prompt:
pnputil /enum-devices /class Camera /connected
Will print:
Microsoft PnP Utility
Instance ID: USB\VID_0C45&PID_672E&MI_02\6&3d846a0&0&0002
Device Description: Integrated Webcam
Class Name: Camera
Class GUID: {ca3e7ab9-b4c3-4ae6-8251-579ef933890f}
Manufacturer Name: Microsoft
Status: Started
Driver Name: usbvideo.inf
Instance ID: USB\VID_0C45&PID_672E&MI_00\6&3d846a0&0&0000
Device Description: Integrated Webcam
Class Name: Camera
Class GUID: {ca3e7ab9-b4c3-4ae6-8251-579ef933890f}
Manufacturer Name: Microsoft
Status: Started
Driver Name: usbvideo.inf
Instance ID: USB\VID_0FD9&PID_0078&MI_00\8&e3fc9d&0&0000
Device Description: Elgato Facecam
Class Name: Camera
Class GUID: {ca3e7ab9-b4c3-4ae6-8251-579ef933890f}
Manufacturer Name: Microsoft
Status: Started
Driver Name: usbvideo.inf
PowerShell:
Get-PnpDevice -PresentOnly -Class Camera
Will print:
Status Class FriendlyName InstanceId
------ ----- ------------ ----------
OK Camera Integrated Webcam USB\VID_0C45...
OK Camera Integrated Webcam USB\VID_0C45...
OK Camera Elgato Facecam USB\VID_0FD9...
You cannot reliably distinguish internal and external cameras using trivial filters (as shown above). You’ll have to go by the name or other hints.
Some older webcams which do not use the USB Video Class may not appear in the Camera class. Instead, the could be using the Image class, which today is usually used for document scanners and the like.
With pnputil
, you’ll have to run two commands to get both classes. With PowerShell, you only need one:
Get-PnpDevice -PresentOnly -Class Camera,Image
Output (different PC, without -PresentOnly
, hence the Unknown):
Status Class FriendlyName InstanceId
------ ----- ------------ ----------
Unknown Image Logitech QuickCam 3000 USB\VID_...
Unknown Image Brother DCP-9022CDW [3c2af42c08de] SWD\DAFW...
Unknown Camera HTC Vive USB\VID_...
However, again, this only applies to very old hardware and it will also catch non-camera devices, like the multi-function printer above.
Get-PnpDevice -FriendlyName *webcam*