16

I have multiple laptops I can remote into, but I do not know whether they have a working webcam. I cannot see them. I do not need to access the webcams; I just need to know if one is present.

Is there a way to remotely tell whether a laptop has a webcam?

I would prefer some sort of cmd code that I can trigger on each to quickly give me a copy-able printout of such information to compile across computers.

4
  • 1
    Need far more information. Are these on a domain? Are you an admin?
    – Keltari
    Commented Feb 14, 2023 at 15:08
  • 1
    I'm just a user with local admin rights on our research computers. We have computers set up in multiple locations. Using VPN, I can access local accounts on each machine using remote desktop. Commented Feb 14, 2023 at 15:12
  • 1
    See How Get All Camera Devices ID From PowerShell
    – Blindspots
    Commented Feb 14, 2023 at 15:14
  • 1
    Get-PnpDevice -FriendlyName *webcam*
    – DavidPostill
    Commented Feb 14, 2023 at 15:15

3 Answers 3

30

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.

5
  • I suspect nearly every 'laptop' webcam's connected via USB. In theory a RPi style direct connection is possible but its something that I've never seen in the wild - which is likely why there's no 'obvious' difference
    – Journeyman Geek
    Commented Feb 14, 2023 at 15:19
  • 4
    Note: Both of these commands only show the internal camera on my laptop, not the external one connected by USB. Commented Feb 15, 2023 at 7:22
  • 1
    They do show any external camera devices, as visible in the example output.
    – Daniel B
    Commented Feb 15, 2023 at 9:06
  • 5
    Not on my machine. I'm not saying the command is wrong, I'm just saying you should not rely on it to show all devices that are actually connected. There could be more. My Logitech webcam is registered as class "Image" instead of"Camera". Commented Feb 15, 2023 at 11:14
  • 6
    Modern webcams, which all use the USB Video Class (UVC), will show up in the Camera class. You are right that older cameras with proprietary drivers may show up in the Image category. I’ll adapt my answer.
    – Daniel B
    Commented Feb 15, 2023 at 19:04
7

PowerShell looks like a good option. From Use PowerShell to discover laptop webcam a couple of options are given.

The one that worked for me is

Get-CimInstance Win32_PnPEntity | where caption -match 'cam'

You may have to run the command a few times with variations of "camera" or "cam" or other terms that can catch all the various options. My camera for example is a Microsoft LifeCam that will not be seen if you search for "camera"

You might be able to see more if you modify your search to look for

Get-CimInstance Win32_PnPEntity | where PNPClass -match 'Image'

Which would show you all imaging devices and may include scanners and other devices.

1
  • 2
    The first command is the only one listed here that shows both of my cameras, internal and external; the second command only shows my external cam, but not the internal. Commented Feb 15, 2023 at 7:23
6

I haven't extensively tested this but

Get-PnpDevice -PresentOnly | Where-Object { $_.Class -match '^Camera' } seems to work - kinda started with this SO answer and adjusted to fit

It'll also give you the name of the camera model under 'friendly name'

2
  • 2
    Note: This command only shows the internal camera on my laptop, not the external one connected by USB. Commented Feb 15, 2023 at 7:23
  • I tested it on an external one - two actually and it works fine
    – Journeyman Geek
    Commented Feb 15, 2023 at 7:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .