PowerTip: Use PowerShell to Discover Laptop Webcam

Summary: Use Windows PowerShell to discover a webcam attached to your laptop.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find a webcam or camera that is attached to my laptop?

Hey, Scripting Guy! Answer Use the Get-CimInstance or the Get-WmiObject cmdlet, examine the Win32_PnpEntity WMI class,
          and look for something that matches camera in the caption.

By using Get-CimInstance in Windows PowerShell 3.0 or later:

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

By using Get-WmiObject in Windows PowerShell 2.0:

Get-WmiObject Win32_PnPEntity | where {$_.caption -match 'camera'}

Note  Not all webcams populate exactly the same way, so it may take a bit of searching
to find the right string.

Comments (7)

  1. jrv says:

    On Windows 8.1 laptops an other systems with OEM cameras this may be needed:

    Get-WmiObject Win32_PnPEntity | where {$_.caption -match ‘webcam’}


    Get-WmiObject Win32_PnPEntity | where {$_.caption -match ‘webcam’ -or $_.Caption -match ‘camera’}

  2. Great tip. Windows Powershell 3.0 provides direct cmdlets buts have found Get-Wmiobject to be very useful a swell especially when you need to query a remote system. It supports the -credential switch. Thanks again for posting this!

  3. David Kalin says:

    Pretty good posting here,I never thought about that I will catch any information

    http://www.visec.net/index.php http://www.freesimusa.com Prepaid Sim Cards,Unlimited Mobile Calls,International Sim Card,International Free Calls,Data Sim Card Usa,Global Sim

  4. Moshiur says:

    I think you are doing a great job. You did things the right way from get go by launching it properly. We can learn a lot from you


  5. Thanks for the tip.