【问题标题】:How Get All Camera Devices ID From PowerShell如何从 PowerShell 获取所有相机设备 ID
【发布时间】:2022-08-11 20:08:06
【问题描述】:

我正在尝试使用 PowerShell 命令行获取所有相机设备 ID 和各自的名称。我尝试了几个命令,但没有完成我的目标。在我的“最佳”方法之下:

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

输出


Caption                     : Remote Desktop Camera Bus
Description                 : UMBus Enumerator
InstallDate                 :
Name                        : Remote Desktop Camera Bus
Status                      : OK
Availability                :
ConfigManagerErrorCode      : 0
ConfigManagerUserConfig     : False
CreationClassName           : Win32_PnPEntity
DeviceID                    : UMB\\UMB\\1&841921D&0&RDCAMERA_BUS
ErrorCleared                :
ErrorDescription            :
LastErrorCode               :
PNPDeviceID                 : UMB\\UMB\\1&841921D&0&RDCAMERA_BUS
PowerManagementCapabilities :
PowerManagementSupported    :
StatusInfo                  :
SystemCreationClassName     : Win32_ComputerSystem
SystemName                  : DESKTOP
ClassGuid                   : {4d36e97d-e325-11ce-bfc1-08002be10318}
CompatibleID                :
HardwareID                  : {UMB\\UMBUS}
Manufacturer                : Microsoft
PNPClass                    : System
Present                     : True
Service                     : umbus
PSComputerName              :

例如,我知道集成相机的名称通常为“集成相机”,ID 为“0”。但这不是所展示的。

  • 你怎么“知道”他们被贴上什么标签?
  • 我已经在 C 中使用 MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUIDinclude <mfapi.h> #include <mfobjects.h> #include <Mfidl.h> 做到了这一点
  • @AbrahamZinala 现在您知道了,您知道如何回答我的问题吗?
  • 那么,您是说该属性为您提供了这些属性?您可以使用 P/Invoke
  • 你能告诉我如何在 Power shell 上使用它吗?

标签: powershell wmi webcam


【解决方案1】:
Get-CimInstance Win32_PnPEntity | ? { $_.service -eq "usbvideo" } | % { $_.PNPDeviceID }

【讨论】:

    猜你喜欢
    • 2012-11-22
    • 2017-08-09
    • 1970-01-01
    • 2017-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多