0

What is the difference between the CimClass(es) CIM_USB_Device and CIM_USBHub? They both emit the same type and appear to produce the same set of objects?

PS C:\src\t> Get-CimInstance CIM_USBDevice | % { $_.Name }
USB Root Hub (USB 3.0)
Generic USB Hub
USB Composite Device
Genesys Logic USB2.0 Card Reader
USB Composite Device
USB Root Hub
Generic USB Hub
USB Root Hub
PS C:\src\t> Get-CimInstance CIM_USBHub | % { $_.Name }
USB Root Hub (USB 3.0)
Generic USB Hub
USB Composite Device
Genesys Logic USB2.0 Card Reader
USB Composite Device
USB Root Hub
Generic USB Hub
USB Root Hub
PS C:\src\t> Get-CimInstance Win32_USBHub | % { $_.Name }
USB Root Hub (USB 3.0)
Generic USB Hub
USB Composite Device
Genesys Logic USB2.0 Card Reader
USB Composite Device
USB Root Hub
Generic USB Hub
USB Root Hub
PS C:\src\t> Get-CimInstance CIM_USBDevice | gm

   TypeName: Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_USBHub

PS C:\src\t> Get-CimInstance CIM_USBHub | gm

   TypeName: Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_USBHub

PS C:\src\t> Get-CimInstance Win32_USBHub | gm

   TypeName: Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_USBHub
lit
  • 14,456
  • 10
  • 65
  • 119

2 Answers2

0

Answer to the question could be drawn from basic reference (see the links below). Another matter is the Microsoft implementation of these concepts.

Class CIM_USBDevice extends CIM_LogicalDevice; there is a direct known subclass: CIM_USBHub.

Class CIM_USBHub extends CIM_USBDevice (see Local Class Properties GangSwitched and NumberOfPorts).

Win32_USBHub class belongs to Win32 schema, i.e. a Microsoft extension to the CIM schema that contains definitions of classes and instances to represent managed objects that exist in a typical Windows environment. See also extension schema: the third layer of the CIM schema, which includes platform-specific extensions of the CIM schema such as Windows, UNIX, and Exchange Server. Also see common model and core model.

JosefZ
  • 28,460
  • 5
  • 44
  • 83
  • Many thanks for the good references. This looks like a dark and twisty passage. – lit Jul 03 '17 at 13:03
-1

Apparently Win32_USBHub is a legacy-compatibility class to return if the code queries WMI using Get-WMIObject cmdlet, and CIM_USBHub is its direct "new model" superclass, to be used with Get-CIMInstance. CIM_USBDevice is CIM_USBHub's superclass, and should there be any other USB device that is not an USB hub if classified internally, like an unknown device attached via USB, it will show up in query for CIM_USBDevice but not in CIM_USBHub.

Vesper
  • 18,599
  • 6
  • 39
  • 61