PowerTip: Use PowerShell to Discover Laptop Webcam

PowerTip: Use PowerShell to Discover Laptop Webcam

  • Comments 13
  • Likes

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.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • thanks

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

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

  • 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

    www,laptopforus.com

  • 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!

  • thanks

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

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

    OR

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