The Win32_PortConnector WMI class represents physical connection ports, such as DB-25 pin male, Centronics, or PS/2.
Methods
Win32_PortConnector has no methods.
Properties
Win32_PortConnector returns 20 properties:
'Caption','ConnectorPinout','ConnectorType','CreationClassName','Description',
'ExternalReferenceDesignator','InstallDate','InternalReferenceDesignator','Manufacturer','Model','Name',
'OtherIdentifyingInfo','PartNumber','PortType','PoweredOn','SerialNumber','SKU','Status','Tag','Version'
Unless explicitly marked as writeable, all properties are read-only. Read all properties for all instances:
Get-CimInstance -ClassName Win32_PortConnector -Property *
Most WMI classes return one or more instances.
When
Get-CimInstance
returns no result, then apparently no instances of class Win32_PortConnector exist. This is normal behavior.Either the class is not implemented on your system (may be deprecated or due to missing drivers, i.e. CIM_VideoControllerResolution), or there are simply no physical representations of this class currently available (i.e. Win32_TapeDrive).
Caption
Short description of the objectâa one-line string.
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, Caption
ConnectorPinout
Pin configuration and signal usage of a physical connector.
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, ConnectorPinout
ConnectorType
Array of physical attributes of the connector used by this port.
ConnectorType returns a numeric value. To translate it into a meaningful text, use any of the following approaches:
Use a PowerShell Hashtable
$ConnectorType_map = @{
0 = 'Unknown'
1 = 'Other'
2 = 'Male'
3 = 'Female'
4 = 'Shielded'
5 = 'Unshielded'
6 = 'SCSI (A) High-Density (50 pins)'
7 = 'SCSI (A) Low-Density (50 pins)'
8 = 'SCSI (P) High-Density (68 pins)'
9 = 'SCSI SCA-I (80 pins)'
10 = 'SCSI SCA-II (80 pins)'
11 = 'SCSI Fibre Channel (DB-9, Copper)'
12 = 'SCSI Fibre Channel (Fibre)'
13 = 'SCSI Fibre Channel SCA-II (40 pins)'
14 = 'SCSI Fibre Channel SCA-II (20 pins)'
15 = 'SCSI Fibre Channel BNC'
16 = 'ATA 3-1/2 Inch (40 pins)'
17 = 'ATA 2-1/2 Inch (44 pins)'
18 = 'ATA-2'
19 = 'ATA-3'
20 = 'ATA/66'
21 = 'DB-9'
22 = 'DB-15'
23 = 'DB-25'
24 = 'DB-36'
25 = 'RS-232C'
26 = 'RS-422'
27 = 'RS-423'
28 = 'RS-485'
29 = 'RS-449'
30 = 'V.35'
31 = 'X.21'
32 = 'IEEE-488'
33 = 'AUI'
34 = 'UTP Category 3'
35 = 'UTP Category 4'
36 = 'UTP Category 5'
37 = 'BNC'
38 = 'RJ11'
39 = 'RJ45'
40 = 'Fiber MIC'
41 = 'Apple AUI'
42 = 'Apple GeoPort'
43 = 'PCI'
44 = 'ISA'
45 = 'EISA'
46 = 'VESA'
47 = 'PCMCIA'
48 = 'PCMCIA Type I'
49 = 'PCMCIA Type II'
50 = 'PCMCIA Type III'
51 = 'ZV Port'
52 = 'CardBus'
53 = 'USB'
54 = 'IEEE 1394'
55 = 'HIPPI'
56 = 'HSSDC (6 pins)'
57 = 'GBIC'
58 = 'DIN'
59 = 'Mini-DIN'
60 = 'Micro-DIN'
61 = 'PS/2'
62 = 'Infrared'
63 = 'HP-HIL'
64 = 'Access.bus'
65 = 'NuBus'
66 = 'Centronics'
67 = 'Mini-Centronics'
68 = 'Mini-Centronics Type-14'
69 = 'Mini-Centronics Type-20'
70 = 'Mini-Centronics Type-26'
71 = 'Bus Mouse'
72 = 'ADB'
73 = 'AGP'
74 = 'VME Bus'
75 = 'VME64'
76 = 'Proprietary'
77 = 'Proprietary Processor Card Slot'
78 = 'Proprietary Memory Card Slot'
79 = 'Proprietary I/O Riser Slot'
80 = 'PCI-66MHZ'
81 = 'AGP2X'
82 = 'AGP4X'
83 = 'PC-98'
84 = 'PC-98Hireso'
85 = 'PC-H98'
86 = 'PC-98Note'
87 = 'PC-98Full'
88 = 'Mini-Jack'
89 = 'On Board Floppy'
90 = '9 Pin Dual Inline (pin 10 cut)'
91 = '25 Pin Dual Inline (pin 26 cut)'
92 = '50 Pin Dual Inline'
93 = '68 Pin Dual Inline'
94 = 'On Board Sound Input from CD-ROM'
}
Use a switch statement
switch([int]$value)
{
0 {'Unknown'}
1 {'Other'}
2 {'Male'}
3 {'Female'}
4 {'Shielded'}
5 {'Unshielded'}
6 {'SCSI (A) High-Density (50 pins)'}
7 {'SCSI (A) Low-Density (50 pins)'}
8 {'SCSI (P) High-Density (68 pins)'}
9 {'SCSI SCA-I (80 pins)'}
10 {'SCSI SCA-II (80 pins)'}
11 {'SCSI Fibre Channel (DB-9, Copper)'}
12 {'SCSI Fibre Channel (Fibre)'}
13 {'SCSI Fibre Channel SCA-II (40 pins)'}
14 {'SCSI Fibre Channel SCA-II (20 pins)'}
15 {'SCSI Fibre Channel BNC'}
16 {'ATA 3-1/2 Inch (40 pins)'}
17 {'ATA 2-1/2 Inch (44 pins)'}
18 {'ATA-2'}
19 {'ATA-3'}
20 {'ATA/66'}
21 {'DB-9'}
22 {'DB-15'}
23 {'DB-25'}
24 {'DB-36'}
25 {'RS-232C'}
26 {'RS-422'}
27 {'RS-423'}
28 {'RS-485'}
29 {'RS-449'}
30 {'V.35'}
31 {'X.21'}
32 {'IEEE-488'}
33 {'AUI'}
34 {'UTP Category 3'}
35 {'UTP Category 4'}
36 {'UTP Category 5'}
37 {'BNC'}
38 {'RJ11'}
39 {'RJ45'}
40 {'Fiber MIC'}
41 {'Apple AUI'}
42 {'Apple GeoPort'}
43 {'PCI'}
44 {'ISA'}
45 {'EISA'}
46 {'VESA'}
47 {'PCMCIA'}
48 {'PCMCIA Type I'}
49 {'PCMCIA Type II'}
50 {'PCMCIA Type III'}
51 {'ZV Port'}
52 {'CardBus'}
53 {'USB'}
54 {'IEEE 1394'}
55 {'HIPPI'}
56 {'HSSDC (6 pins)'}
57 {'GBIC'}
58 {'DIN'}
59 {'Mini-DIN'}
60 {'Micro-DIN'}
61 {'PS/2'}
62 {'Infrared'}
63 {'HP-HIL'}
64 {'Access.bus'}
65 {'NuBus'}
66 {'Centronics'}
67 {'Mini-Centronics'}
68 {'Mini-Centronics Type-14'}
69 {'Mini-Centronics Type-20'}
70 {'Mini-Centronics Type-26'}
71 {'Bus Mouse'}
72 {'ADB'}
73 {'AGP'}
74 {'VME Bus'}
75 {'VME64'}
76 {'Proprietary'}
77 {'Proprietary Processor Card Slot'}
78 {'Proprietary Memory Card Slot'}
79 {'Proprietary I/O Riser Slot'}
80 {'PCI-66MHZ'}
81 {'AGP2X'}
82 {'AGP4X'}
83 {'PC-98'}
84 {'PC-98Hireso'}
85 {'PC-H98'}
86 {'PC-98Note'}
87 {'PC-98Full'}
88 {'Mini-Jack'}
89 {'On Board Floppy'}
90 {'9 Pin Dual Inline (pin 10 cut)'}
91 {'25 Pin Dual Inline (pin 26 cut)'}
92 {'50 Pin Dual Inline'}
93 {'68 Pin Dual Inline'}
94 {'On Board Sound Input from CD-ROM'}
default {"$value"}
}
Use Enum structure
Enum EnumConnectorType
{
Unknown = 0
Other = 1
Male = 2
Female = 3
Shielded = 4
Unshielded = 5
SCSI_A_High_Density_50_pins = 6
SCSI_A_Low_Density_50_pins = 7
SCSI_P_High_Density_68_pins = 8
SCSI_SCA_I_80_pins = 9
SCSI_SCA_II_80_pins = 10
SCSI_Fibre_Channel_DB_9_Copper = 11
SCSI_Fibre_Channel_Fibre = 12
SCSI_Fibre_Channel_SCA_II_40_pins = 13
SCSI_Fibre_Channel_SCA_II_20_pins = 14
SCSI_Fibre_Channel_BNC = 15
ATA_3_12_Inch_40_pins = 16
ATA_2_12_Inch_44_pins = 17
ATA_2 = 18
ATA_3 = 19
ATA66 = 20
DB_9 = 21
DB_15 = 22
DB_25 = 23
DB_36 = 24
RS_232C = 25
RS_422 = 26
RS_423 = 27
RS_485 = 28
RS_449 = 29
V35 = 30
X21 = 31
IEEE_488 = 32
AUI = 33
UTP_Category_3 = 34
UTP_Category_4 = 35
UTP_Category_5 = 36
BNC = 37
RJ11 = 38
RJ45 = 39
Fiber_MIC = 40
Apple_AUI = 41
Apple_GeoPort = 42
PCI = 43
ISA = 44
EISA = 45
VESA = 46
PCMCIA = 47
PCMCIA_Type_I = 48
PCMCIA_Type_II = 49
PCMCIA_Type_III = 50
ZV_Port = 51
CardBus = 52
USB = 53
IEEE_1394 = 54
HIPPI = 55
HSSDC_6_pins = 56
GBIC = 57
DIN = 58
Mini_DIN = 59
Micro_DIN = 60
PS2 = 61
Infrared = 62
HP_HIL = 63
Accessbus = 64
NuBus = 65
Centronics = 66
Mini_Centronics = 67
Mini_Centronics_Type_14 = 68
Mini_Centronics_Type_20 = 69
Mini_Centronics_Type_26 = 70
Bus_Mouse = 71
ADB = 72
AGP = 73
VME_Bus = 74
VME64 = 75
Proprietary = 76
Proprietary_Processor_Card_Slot = 77
Proprietary_Memory_Card_Slot = 78
Proprietary_IO_Riser_Slot = 79
PCI_66MHZ = 80
AGP2X = 81
AGP4X = 82
PC_98 = 83
PC_98Hireso = 84
PC_H98 = 85
PC_98Note = 86
PC_98Full = 87
Mini_Jack = 88
On_Board_Floppy = 89
_9_Pin_Dual_Inline_pin_10_cut = 90
_25_Pin_Dual_Inline_pin_26_cut = 91
_50_Pin_Dual_Inline = 92
_68_Pin_Dual_Inline = 93
On_Board_Sound_Input_from_CD_ROM = 94
}
Examples
Use $ConnectorType_map in a calculated property for Select-Object
<#
this example uses a hashtable to translate raw numeric values for
property "ConnectorType" to friendly text
Note: to use other properties than "ConnectorType", look up the appropriate
translation hashtable for the property you would like to use instead.
#>
#region define hashtable to translate raw values to friendly text
# Please note: this hashtable is specific for property "ConnectorType"
# to translate other properties, use their translation table instead
$ConnectorType_map = @{
0 = 'Unknown'
1 = 'Other'
2 = 'Male'
3 = 'Female'
4 = 'Shielded'
5 = 'Unshielded'
6 = 'SCSI (A) High-Density (50 pins)'
7 = 'SCSI (A) Low-Density (50 pins)'
8 = 'SCSI (P) High-Density (68 pins)'
9 = 'SCSI SCA-I (80 pins)'
10 = 'SCSI SCA-II (80 pins)'
11 = 'SCSI Fibre Channel (DB-9, Copper)'
12 = 'SCSI Fibre Channel (Fibre)'
13 = 'SCSI Fibre Channel SCA-II (40 pins)'
14 = 'SCSI Fibre Channel SCA-II (20 pins)'
15 = 'SCSI Fibre Channel BNC'
16 = 'ATA 3-1/2 Inch (40 pins)'
17 = 'ATA 2-1/2 Inch (44 pins)'
18 = 'ATA-2'
19 = 'ATA-3'
20 = 'ATA/66'
21 = 'DB-9'
22 = 'DB-15'
23 = 'DB-25'
24 = 'DB-36'
25 = 'RS-232C'
26 = 'RS-422'
27 = 'RS-423'
28 = 'RS-485'
29 = 'RS-449'
30 = 'V.35'
31 = 'X.21'
32 = 'IEEE-488'
33 = 'AUI'
34 = 'UTP Category 3'
35 = 'UTP Category 4'
36 = 'UTP Category 5'
37 = 'BNC'
38 = 'RJ11'
39 = 'RJ45'
40 = 'Fiber MIC'
41 = 'Apple AUI'
42 = 'Apple GeoPort'
43 = 'PCI'
44 = 'ISA'
45 = 'EISA'
46 = 'VESA'
47 = 'PCMCIA'
48 = 'PCMCIA Type I'
49 = 'PCMCIA Type II'
50 = 'PCMCIA Type III'
51 = 'ZV Port'
52 = 'CardBus'
53 = 'USB'
54 = 'IEEE 1394'
55 = 'HIPPI'
56 = 'HSSDC (6 pins)'
57 = 'GBIC'
58 = 'DIN'
59 = 'Mini-DIN'
60 = 'Micro-DIN'
61 = 'PS/2'
62 = 'Infrared'
63 = 'HP-HIL'
64 = 'Access.bus'
65 = 'NuBus'
66 = 'Centronics'
67 = 'Mini-Centronics'
68 = 'Mini-Centronics Type-14'
69 = 'Mini-Centronics Type-20'
70 = 'Mini-Centronics Type-26'
71 = 'Bus Mouse'
72 = 'ADB'
73 = 'AGP'
74 = 'VME Bus'
75 = 'VME64'
76 = 'Proprietary'
77 = 'Proprietary Processor Card Slot'
78 = 'Proprietary Memory Card Slot'
79 = 'Proprietary I/O Riser Slot'
80 = 'PCI-66MHZ'
81 = 'AGP2X'
82 = 'AGP4X'
83 = 'PC-98'
84 = 'PC-98Hireso'
85 = 'PC-H98'
86 = 'PC-98Note'
87 = 'PC-98Full'
88 = 'Mini-Jack'
89 = 'On Board Floppy'
90 = '9 Pin Dual Inline (pin 10 cut)'
91 = '25 Pin Dual Inline (pin 26 cut)'
92 = '50 Pin Dual Inline'
93 = '68 Pin Dual Inline'
94 = 'On Board Sound Input from CD-ROM'
}
#endregion define hashtable
#region define calculated property (to be used with Select-Object)
<#
a calculated property is defined by a hashtable with keys "Name" and "Expression"
"Name" defines the name of the property (in this example, it is "ConnectorType", but you can rename it to anything else)
"Expression" defines a scriptblock that calculates the content of this property
in this example, the scriptblock uses the hashtable defined earlier to translate each numeric
value to its friendly text counterpart:
#>
$ConnectorType = @{
Name = 'ConnectorType'
Expression = {
# property is an array, so process all values
$result = foreach($value in $_.ConnectorType)
{
# important: convert original value to [int] because
# hashtable keys are type-aware:
$ConnectorType_map[[int]$value]
}
# uncomment to get a comma-separated string instead
# of a string array:
$result <#-join ', '#>
}
}
#endregion define calculated property
# retrieve the instances, and output the properties "Caption" and "ConnectorType". The latter
# is defined by the hashtable in $ConnectorType:
Get-CimInstance -Class Win32_PortConnector | Select-Object -Property Caption, $ConnectorType
# ...or dump content of property ConnectorType:
$friendlyValues = Get-CimInstance -Class Win32_PortConnector |
Select-Object -Property $ConnectorType |
Select-Object -ExpandProperty ConnectorType
# output values
$friendlyValues
# output values as comma separated list
$friendlyValues -join ', '
# output values as bullet list
$friendlyValues | ForEach-Object { "- $_" }
Use $ConnectorType_map to directly translate raw values from an instance
<#
this example uses a hashtable to manually translate raw numeric values
for property "Win32_PortConnector" to friendly text. This approach is ideal when there
is just one instance to work with.
Note: to use other properties than "Win32_PortConnector", look up the appropriate
translation hashtable for the property you would like to use instead.
#>
#region define hashtable to translate raw values to friendly text
# Please note: this hashtable is specific for property "Win32_PortConnector"
# to translate other properties, use their translation table instead
$ConnectorType_map = @{
0 = 'Unknown'
1 = 'Other'
2 = 'Male'
3 = 'Female'
4 = 'Shielded'
5 = 'Unshielded'
6 = 'SCSI (A) High-Density (50 pins)'
7 = 'SCSI (A) Low-Density (50 pins)'
8 = 'SCSI (P) High-Density (68 pins)'
9 = 'SCSI SCA-I (80 pins)'
10 = 'SCSI SCA-II (80 pins)'
11 = 'SCSI Fibre Channel (DB-9, Copper)'
12 = 'SCSI Fibre Channel (Fibre)'
13 = 'SCSI Fibre Channel SCA-II (40 pins)'
14 = 'SCSI Fibre Channel SCA-II (20 pins)'
15 = 'SCSI Fibre Channel BNC'
16 = 'ATA 3-1/2 Inch (40 pins)'
17 = 'ATA 2-1/2 Inch (44 pins)'
18 = 'ATA-2'
19 = 'ATA-3'
20 = 'ATA/66'
21 = 'DB-9'
22 = 'DB-15'
23 = 'DB-25'
24 = 'DB-36'
25 = 'RS-232C'
26 = 'RS-422'
27 = 'RS-423'
28 = 'RS-485'
29 = 'RS-449'
30 = 'V.35'
31 = 'X.21'
32 = 'IEEE-488'
33 = 'AUI'
34 = 'UTP Category 3'
35 = 'UTP Category 4'
36 = 'UTP Category 5'
37 = 'BNC'
38 = 'RJ11'
39 = 'RJ45'
40 = 'Fiber MIC'
41 = 'Apple AUI'
42 = 'Apple GeoPort'
43 = 'PCI'
44 = 'ISA'
45 = 'EISA'
46 = 'VESA'
47 = 'PCMCIA'
48 = 'PCMCIA Type I'
49 = 'PCMCIA Type II'
50 = 'PCMCIA Type III'
51 = 'ZV Port'
52 = 'CardBus'
53 = 'USB'
54 = 'IEEE 1394'
55 = 'HIPPI'
56 = 'HSSDC (6 pins)'
57 = 'GBIC'
58 = 'DIN'
59 = 'Mini-DIN'
60 = 'Micro-DIN'
61 = 'PS/2'
62 = 'Infrared'
63 = 'HP-HIL'
64 = 'Access.bus'
65 = 'NuBus'
66 = 'Centronics'
67 = 'Mini-Centronics'
68 = 'Mini-Centronics Type-14'
69 = 'Mini-Centronics Type-20'
70 = 'Mini-Centronics Type-26'
71 = 'Bus Mouse'
72 = 'ADB'
73 = 'AGP'
74 = 'VME Bus'
75 = 'VME64'
76 = 'Proprietary'
77 = 'Proprietary Processor Card Slot'
78 = 'Proprietary Memory Card Slot'
79 = 'Proprietary I/O Riser Slot'
80 = 'PCI-66MHZ'
81 = 'AGP2X'
82 = 'AGP4X'
83 = 'PC-98'
84 = 'PC-98Hireso'
85 = 'PC-H98'
86 = 'PC-98Note'
87 = 'PC-98Full'
88 = 'Mini-Jack'
89 = 'On Board Floppy'
90 = '9 Pin Dual Inline (pin 10 cut)'
91 = '25 Pin Dual Inline (pin 26 cut)'
92 = '50 Pin Dual Inline'
93 = '68 Pin Dual Inline'
94 = 'On Board Sound Input from CD-ROM'
}
#endregion define hashtable
# get one instance:
$instance = Get-CimInstance -Class Win32_PortConnector | Select-Object -First 1
<#
IMPORTANT: this example processes only one instance to illustrate
the number-to-text translation. To process all instances, replace
"Select-Object -First 1" with a "Foreach-Object" loop, and use
the iterator variable $_ instead of $instance
#>
# query the property (hint: the property is an array!)
$rawValues = $instance.ConnectorType
# translate all raw values into friendly names:
$friendlyNames = foreach($rawValue in $rawValues)
{ $ConnectorType_map[[int]$rawValue] }
# output values
$friendlyValues
# output values as comma separated list
$friendlyValues -join ', '
# output values as bullet list
$friendlyValues | ForEach-Object { "- $_" }
Use a switch statement inside a calculated property for Select-Object
<#
this example uses a switch clause to translate raw numeric
values for property "ConnectorType" to friendly text. The switch
clause is embedded into a calculated property so there is
no need to refer to external variables for translation.
Note: to use other properties than "ConnectorType", look up the appropriate
translation switch clause for the property you would like to use instead.
#>
#region define calculated property (to be used with Select-Object)
<#
a calculated property is defined by a hashtable with keys "Name" and "Expression"
"Name" defines the name of the property (in this example, it is "ConnectorType", but you can rename it to anything else)
"Expression" defines a scriptblock that calculates the content of this property
in this example, the scriptblock uses the hashtable defined earlier to translate each numeric
value to its friendly text counterpart:
#>
$ConnectorType = @{
Name = 'ConnectorType'
Expression = {
# property is an array, so process all values
$result = foreach($value in $_.ConnectorType)
{
switch([int]$value)
{
0 {'Unknown'}
1 {'Other'}
2 {'Male'}
3 {'Female'}
4 {'Shielded'}
5 {'Unshielded'}
6 {'SCSI (A) High-Density (50 pins)'}
7 {'SCSI (A) Low-Density (50 pins)'}
8 {'SCSI (P) High-Density (68 pins)'}
9 {'SCSI SCA-I (80 pins)'}
10 {'SCSI SCA-II (80 pins)'}
11 {'SCSI Fibre Channel (DB-9, Copper)'}
12 {'SCSI Fibre Channel (Fibre)'}
13 {'SCSI Fibre Channel SCA-II (40 pins)'}
14 {'SCSI Fibre Channel SCA-II (20 pins)'}
15 {'SCSI Fibre Channel BNC'}
16 {'ATA 3-1/2 Inch (40 pins)'}
17 {'ATA 2-1/2 Inch (44 pins)'}
18 {'ATA-2'}
19 {'ATA-3'}
20 {'ATA/66'}
21 {'DB-9'}
22 {'DB-15'}
23 {'DB-25'}
24 {'DB-36'}
25 {'RS-232C'}
26 {'RS-422'}
27 {'RS-423'}
28 {'RS-485'}
29 {'RS-449'}
30 {'V.35'}
31 {'X.21'}
32 {'IEEE-488'}
33 {'AUI'}
34 {'UTP Category 3'}
35 {'UTP Category 4'}
36 {'UTP Category 5'}
37 {'BNC'}
38 {'RJ11'}
39 {'RJ45'}
40 {'Fiber MIC'}
41 {'Apple AUI'}
42 {'Apple GeoPort'}
43 {'PCI'}
44 {'ISA'}
45 {'EISA'}
46 {'VESA'}
47 {'PCMCIA'}
48 {'PCMCIA Type I'}
49 {'PCMCIA Type II'}
50 {'PCMCIA Type III'}
51 {'ZV Port'}
52 {'CardBus'}
53 {'USB'}
54 {'IEEE 1394'}
55 {'HIPPI'}
56 {'HSSDC (6 pins)'}
57 {'GBIC'}
58 {'DIN'}
59 {'Mini-DIN'}
60 {'Micro-DIN'}
61 {'PS/2'}
62 {'Infrared'}
63 {'HP-HIL'}
64 {'Access.bus'}
65 {'NuBus'}
66 {'Centronics'}
67 {'Mini-Centronics'}
68 {'Mini-Centronics Type-14'}
69 {'Mini-Centronics Type-20'}
70 {'Mini-Centronics Type-26'}
71 {'Bus Mouse'}
72 {'ADB'}
73 {'AGP'}
74 {'VME Bus'}
75 {'VME64'}
76 {'Proprietary'}
77 {'Proprietary Processor Card Slot'}
78 {'Proprietary Memory Card Slot'}
79 {'Proprietary I/O Riser Slot'}
80 {'PCI-66MHZ'}
81 {'AGP2X'}
82 {'AGP4X'}
83 {'PC-98'}
84 {'PC-98Hireso'}
85 {'PC-H98'}
86 {'PC-98Note'}
87 {'PC-98Full'}
88 {'Mini-Jack'}
89 {'On Board Floppy'}
90 {'9 Pin Dual Inline (pin 10 cut)'}
91 {'25 Pin Dual Inline (pin 26 cut)'}
92 {'50 Pin Dual Inline'}
93 {'68 Pin Dual Inline'}
94 {'On Board Sound Input from CD-ROM'}
default {"$value"}
}
}
$result
}
}
#endregion define calculated property
# retrieve all instances...
Get-CimInstance -ClassName Win32_PortConnector |
# ...and output properties "Caption" and "ConnectorType". The latter is defined
# by the hashtable in $ConnectorType:
Select-Object -Property Caption, $ConnectorType
Use the Enum from above to auto-translate the code values
<#
this example translates raw values by means of type conversion
the friendly names are defined as enumeration using the
keyword "enum" (PowerShell 5 or better)
The raw value(s) are translated to friendly text by
simply converting them into the enum type.
Note: to use other properties than "Win32_PortConnector", look up the appropriate
enum definition for the property you would like to use instead.
#>
#region define enum with value-to-text translation:
Enum EnumConnectorType
{
Unknown = 0
Other = 1
Male = 2
Female = 3
Shielded = 4
Unshielded = 5
SCSI_A_High_Density_50_pins = 6
SCSI_A_Low_Density_50_pins = 7
SCSI_P_High_Density_68_pins = 8
SCSI_SCA_I_80_pins = 9
SCSI_SCA_II_80_pins = 10
SCSI_Fibre_Channel_DB_9_Copper = 11
SCSI_Fibre_Channel_Fibre = 12
SCSI_Fibre_Channel_SCA_II_40_pins = 13
SCSI_Fibre_Channel_SCA_II_20_pins = 14
SCSI_Fibre_Channel_BNC = 15
ATA_3_12_Inch_40_pins = 16
ATA_2_12_Inch_44_pins = 17
ATA_2 = 18
ATA_3 = 19
ATA66 = 20
DB_9 = 21
DB_15 = 22
DB_25 = 23
DB_36 = 24
RS_232C = 25
RS_422 = 26
RS_423 = 27
RS_485 = 28
RS_449 = 29
V35 = 30
X21 = 31
IEEE_488 = 32
AUI = 33
UTP_Category_3 = 34
UTP_Category_4 = 35
UTP_Category_5 = 36
BNC = 37
RJ11 = 38
RJ45 = 39
Fiber_MIC = 40
Apple_AUI = 41
Apple_GeoPort = 42
PCI = 43
ISA = 44
EISA = 45
VESA = 46
PCMCIA = 47
PCMCIA_Type_I = 48
PCMCIA_Type_II = 49
PCMCIA_Type_III = 50
ZV_Port = 51
CardBus = 52
USB = 53
IEEE_1394 = 54
HIPPI = 55
HSSDC_6_pins = 56
GBIC = 57
DIN = 58
Mini_DIN = 59
Micro_DIN = 60
PS2 = 61
Infrared = 62
HP_HIL = 63
Accessbus = 64
NuBus = 65
Centronics = 66
Mini_Centronics = 67
Mini_Centronics_Type_14 = 68
Mini_Centronics_Type_20 = 69
Mini_Centronics_Type_26 = 70
Bus_Mouse = 71
ADB = 72
AGP = 73
VME_Bus = 74
VME64 = 75
Proprietary = 76
Proprietary_Processor_Card_Slot = 77
Proprietary_Memory_Card_Slot = 78
Proprietary_IO_Riser_Slot = 79
PCI_66MHZ = 80
AGP2X = 81
AGP4X = 82
PC_98 = 83
PC_98Hireso = 84
PC_H98 = 85
PC_98Note = 86
PC_98Full = 87
Mini_Jack = 88
On_Board_Floppy = 89
_9_Pin_Dual_Inline_pin_10_cut = 90
_25_Pin_Dual_Inline_pin_26_cut = 91
_50_Pin_Dual_Inline = 92
_68_Pin_Dual_Inline = 93
On_Board_Sound_Input_from_CD_ROM = 94
}
#endregion define enum
# get one instance:
$instance = Get-CimInstance -Class Win32_PortConnector | Select-Object -First 1
<#
IMPORTANT: this example processes only one instance to focus on
the number-to-text type conversion.
To process all instances, replace "Select-Object -First 1"
with a "Foreach-Object" loop, and use the iterator variable
$_ instead of $instance
#>
# query the property:
$rawValue = $instance.ConnectorType
#region using strict type conversion
<#
Note: strict type conversion fails if the raw value is
not defined by the enum. So if the list of allowable values
was extended and the enum does not match the value,
an exception is thrown
#>
# convert the property to the enum **ConnectorType**
[EnumConnectorType[]]$rawValue
# get a comma-separated string:
[EnumConnectorType[]]$rawValue -join ','
#endregion
#region using operator "-as"
<#
Note: the operator "-as" accepts values not defined
by the enum and returns $null instead of throwing
an exception
#>
$rawValue -as [EnumConnectorType[]]
#endregion
Enums must cover all possible values. If ConnectorType returns a value that is not defined in the enum, an exception occurs. The exception reports the value that was missing in the enum. To fix, add the missing value to the enum.
CreationClassName
Name of the first concrete class that appears in the inheritance chain used in the creation of an instance. When used with the other key properties of the class, the property allows all instances of this class and its subclasses to be identified uniquely.
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, CreationClassName
Description
Description of the object.
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, Description
ExternalReferenceDesignator
External reference designator of the port. External reference designators are identifiers that determine the type and use of the port.
Example: “COM1”
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, ExternalReferenceDesignator
InstallDate
Date and time the object is installed. This property does not need a value to indicate that the object is installed.
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, InstallDate
InternalReferenceDesignator
Internal reference designator of the port. Internal reference designators are specific to the manufacturer, and identify the circuit board location or use of the port.
Example: “J101”
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, InternalReferenceDesignator
Manufacturer
Name of the organization responsible for producing the physical element.
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, Manufacturer
Model
Name for the physical element.
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, Model
Name
Label for the object. When subclassed, the property can be overridden to be a key property.
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, Name
OtherIdentifyingInfo
Additional data, beyond asset tag information, that can be used to identify a physical element. One example is bar code data associated with an element that also has an asset tag. If only bar code data is available and unique or able to be used as an element key, this property is NULL and the bar code data is used as the class key in the tag property.
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, OtherIdentifyingInfo
PartNumber
Part number assigned by the organization responsible for producing or manufacturing the physical element.
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, PartNumber
PortType
Function of the port. The following list lists the values.
PortType returns a numeric value. To translate it into a meaningful text, use any of the following approaches:
Use a PowerShell Hashtable
$PortType_map = @{
0 = 'None'
1 = 'Parallel Port XT/AT Compatible'
2 = 'Parallel Port PS/2'
3 = 'Parallel Port ECP'
4 = 'Parallel Port EPP'
5 = 'Parallel Port ECP/EPP'
6 = 'Serial Port XT/AT Compatible'
7 = 'Serial Port 16450 Compatible'
8 = 'Serial Port 16550 Compatible'
9 = 'Serial Port 16550A Compatible'
10 = 'SCSI Port'
11 = 'MIDI Port'
12 = 'Joy Stick Port'
13 = 'Keyboard Port'
14 = 'Mouse Port'
15 = 'SSA SCSI'
16 = 'USB'
17 = 'FireWire (IEEE P1394)'
18 = 'PCMCIA Type II'
19 = 'PCMCIA Type II'
20 = 'PCMCIA Type III'
21 = 'Cardbus'
22 = 'Access Bus Port'
23 = 'SCSI II'
24 = 'SCSI Wide'
25 = 'PC-98'
26 = 'PC-98-Hireso'
27 = 'PC-H98'
28 = 'Video Port'
29 = 'Audio Port'
30 = 'Modem Port'
31 = 'Network Port'
32 = '8251 Compatible'
33 = '8251 FIFO Compatible'
}
Use a switch statement
switch([int]$value)
{
0 {'None'}
1 {'Parallel Port XT/AT Compatible'}
2 {'Parallel Port PS/2'}
3 {'Parallel Port ECP'}
4 {'Parallel Port EPP'}
5 {'Parallel Port ECP/EPP'}
6 {'Serial Port XT/AT Compatible'}
7 {'Serial Port 16450 Compatible'}
8 {'Serial Port 16550 Compatible'}
9 {'Serial Port 16550A Compatible'}
10 {'SCSI Port'}
11 {'MIDI Port'}
12 {'Joy Stick Port'}
13 {'Keyboard Port'}
14 {'Mouse Port'}
15 {'SSA SCSI'}
16 {'USB'}
17 {'FireWire (IEEE P1394)'}
18 {'PCMCIA Type II'}
19 {'PCMCIA Type II'}
20 {'PCMCIA Type III'}
21 {'Cardbus'}
22 {'Access Bus Port'}
23 {'SCSI II'}
24 {'SCSI Wide'}
25 {'PC-98'}
26 {'PC-98-Hireso'}
27 {'PC-H98'}
28 {'Video Port'}
29 {'Audio Port'}
30 {'Modem Port'}
31 {'Network Port'}
32 {'8251 Compatible'}
33 {'8251 FIFO Compatible'}
default {"$value"}
}
Use Enum structure
Enum EnumPortType
{
None = 0
Parallel_Port_XTAT_Compatible = 1
Parallel_Port_PS2 = 2
Parallel_Port_ECP = 3
Parallel_Port_EPP = 4
Parallel_Port_ECPEPP = 5
Serial_Port_XTAT_Compatible = 6
Serial_Port_16450_Compatible = 7
Serial_Port_16550_Compatible = 8
Serial_Port_16550A_Compatible = 9
SCSI_Port = 10
MIDI_Port = 11
Joy_Stick_Port = 12
Keyboard_Port = 13
Mouse_Port = 14
SSA_SCSI = 15
USB = 16
FireWire_IEEE_P1394 = 17
PCMCIA_Type_II1 = 18
PCMCIA_Type_II2 = 19
PCMCIA_Type_III = 20
Cardbus = 21
Access_Bus_Port = 22
SCSI_II = 23
SCSI_Wide = 24
PC_98 = 25
PC_98_Hireso = 26
PC_H98 = 27
Video_Port = 28
Audio_Port = 29
Modem_Port = 30
Network_Port = 31
_8251_Compatible = 32
_8251_FIFO_Compatible = 33
}
Examples
Use $PortType_map in a calculated property for Select-Object
<#
this example uses a hashtable to translate raw numeric values for
property "PortType" to friendly text
Note: to use other properties than "PortType", look up the appropriate
translation hashtable for the property you would like to use instead.
#>
#region define hashtable to translate raw values to friendly text
# Please note: this hashtable is specific for property "PortType"
# to translate other properties, use their translation table instead
$PortType_map = @{
0 = 'None'
1 = 'Parallel Port XT/AT Compatible'
2 = 'Parallel Port PS/2'
3 = 'Parallel Port ECP'
4 = 'Parallel Port EPP'
5 = 'Parallel Port ECP/EPP'
6 = 'Serial Port XT/AT Compatible'
7 = 'Serial Port 16450 Compatible'
8 = 'Serial Port 16550 Compatible'
9 = 'Serial Port 16550A Compatible'
10 = 'SCSI Port'
11 = 'MIDI Port'
12 = 'Joy Stick Port'
13 = 'Keyboard Port'
14 = 'Mouse Port'
15 = 'SSA SCSI'
16 = 'USB'
17 = 'FireWire (IEEE P1394)'
18 = 'PCMCIA Type II'
19 = 'PCMCIA Type II'
20 = 'PCMCIA Type III'
21 = 'Cardbus'
22 = 'Access Bus Port'
23 = 'SCSI II'
24 = 'SCSI Wide'
25 = 'PC-98'
26 = 'PC-98-Hireso'
27 = 'PC-H98'
28 = 'Video Port'
29 = 'Audio Port'
30 = 'Modem Port'
31 = 'Network Port'
32 = '8251 Compatible'
33 = '8251 FIFO Compatible'
}
#endregion define hashtable
#region define calculated property (to be used with Select-Object)
<#
a calculated property is defined by a hashtable with keys "Name" and "Expression"
"Name" defines the name of the property (in this example, it is "PortType", but you can rename it to anything else)
"Expression" defines a scriptblock that calculates the content of this property
in this example, the scriptblock uses the hashtable defined earlier to translate each numeric
value to its friendly text counterpart:
#>
$PortType = @{
Name = 'PortType'
Expression = {
# property is an array, so process all values
$value = $_.PortType
$PortType_map[[int]$value]
}
}
#endregion define calculated property
# retrieve the instances, and output the properties "Caption" and "PortType". The latter
# is defined by the hashtable in $PortType:
Get-CimInstance -Class Win32_PortConnector | Select-Object -Property Caption, $PortType
# ...or dump content of property PortType:
$friendlyValues = Get-CimInstance -Class Win32_PortConnector |
Select-Object -Property $PortType |
Select-Object -ExpandProperty PortType
# output values
$friendlyValues
# output values as comma separated list
$friendlyValues -join ', '
# output values as bullet list
$friendlyValues | ForEach-Object { "- $_" }
Use $PortType_map to directly translate raw values from an instance
<#
this example uses a hashtable to manually translate raw numeric values
for property "Win32_PortConnector" to friendly text. This approach is ideal when
there is just one instance to work with.
Note: to use other properties than "Win32_PortConnector", look up the appropriate
translation hashtable for the property you would like to use instead.
#>
#region define hashtable to translate raw values to friendly text
# Please note: this hashtable is specific for property "Win32_PortConnector"
# to translate other properties, use their translation table instead
$PortType_map = @{
0 = 'None'
1 = 'Parallel Port XT/AT Compatible'
2 = 'Parallel Port PS/2'
3 = 'Parallel Port ECP'
4 = 'Parallel Port EPP'
5 = 'Parallel Port ECP/EPP'
6 = 'Serial Port XT/AT Compatible'
7 = 'Serial Port 16450 Compatible'
8 = 'Serial Port 16550 Compatible'
9 = 'Serial Port 16550A Compatible'
10 = 'SCSI Port'
11 = 'MIDI Port'
12 = 'Joy Stick Port'
13 = 'Keyboard Port'
14 = 'Mouse Port'
15 = 'SSA SCSI'
16 = 'USB'
17 = 'FireWire (IEEE P1394)'
18 = 'PCMCIA Type II'
19 = 'PCMCIA Type II'
20 = 'PCMCIA Type III'
21 = 'Cardbus'
22 = 'Access Bus Port'
23 = 'SCSI II'
24 = 'SCSI Wide'
25 = 'PC-98'
26 = 'PC-98-Hireso'
27 = 'PC-H98'
28 = 'Video Port'
29 = 'Audio Port'
30 = 'Modem Port'
31 = 'Network Port'
32 = '8251 Compatible'
33 = '8251 FIFO Compatible'
}
#endregion define hashtable
# get one instance:
$instance = Get-CimInstance -Class Win32_PortConnector | Select-Object -First 1
<#
IMPORTANT: this example processes only one instance to illustrate
the number-to-text translation. To process all instances, replace
"Select-Object -First 1" with a "Foreach-Object" loop, and use
the iterator variable $_ instead of $instance
#>
# query the property
$rawValue = $instance.PortType
# translate raw value to friendly text:
$friendlyName = $PortType_map[[int]$rawValue]
# output value
$friendlyName
Use a switch statement inside a calculated property for Select-Object
<#
this example uses a switch clause to translate raw numeric
values for property "PortType" to friendly text. The switch
clause is embedded into a calculated property so there is
no need to refer to external variables for translation.
Note: to use other properties than "PortType", look up the appropriate
translation switch clause for the property you would like to use instead.
#>
#region define calculated property (to be used with Select-Object)
<#
a calculated property is defined by a hashtable with keys "Name" and "Expression"
"Name" defines the name of the property (in this example, it is "PortType", but you can rename it to anything else)
"Expression" defines a scriptblock that calculates the content of this property
in this example, the scriptblock uses the hashtable defined earlier to translate each numeric
value to its friendly text counterpart:
#>
$PortType = @{
Name = 'PortType'
Expression = {
# property is an array, so process all values
$value = $_.PortType
switch([int]$value)
{
0 {'None'}
1 {'Parallel Port XT/AT Compatible'}
2 {'Parallel Port PS/2'}
3 {'Parallel Port ECP'}
4 {'Parallel Port EPP'}
5 {'Parallel Port ECP/EPP'}
6 {'Serial Port XT/AT Compatible'}
7 {'Serial Port 16450 Compatible'}
8 {'Serial Port 16550 Compatible'}
9 {'Serial Port 16550A Compatible'}
10 {'SCSI Port'}
11 {'MIDI Port'}
12 {'Joy Stick Port'}
13 {'Keyboard Port'}
14 {'Mouse Port'}
15 {'SSA SCSI'}
16 {'USB'}
17 {'FireWire (IEEE P1394)'}
18 {'PCMCIA Type II'}
19 {'PCMCIA Type II'}
20 {'PCMCIA Type III'}
21 {'Cardbus'}
22 {'Access Bus Port'}
23 {'SCSI II'}
24 {'SCSI Wide'}
25 {'PC-98'}
26 {'PC-98-Hireso'}
27 {'PC-H98'}
28 {'Video Port'}
29 {'Audio Port'}
30 {'Modem Port'}
31 {'Network Port'}
32 {'8251 Compatible'}
33 {'8251 FIFO Compatible'}
default {"$value"}
}
}
}
#endregion define calculated property
# retrieve all instances...
Get-CimInstance -ClassName Win32_PortConnector |
# ...and output properties "Caption" and "PortType". The latter is defined
# by the hashtable in $PortType:
Select-Object -Property Caption, $PortType
Use the Enum from above to auto-translate the code values
<#
this example translates raw values by means of type conversion
the friendly names are defined as enumeration using the
keyword "enum" (PowerShell 5 or better)
The raw value(s) are translated to friendly text by
simply converting them into the enum type.
Note: to use other properties than "Win32_PortConnector", look up the appropriate
enum definition for the property you would like to use instead.
#>
#region define enum with value-to-text translation:
Enum EnumPortType
{
None = 0
Parallel_Port_XTAT_Compatible = 1
Parallel_Port_PS2 = 2
Parallel_Port_ECP = 3
Parallel_Port_EPP = 4
Parallel_Port_ECPEPP = 5
Serial_Port_XTAT_Compatible = 6
Serial_Port_16450_Compatible = 7
Serial_Port_16550_Compatible = 8
Serial_Port_16550A_Compatible = 9
SCSI_Port = 10
MIDI_Port = 11
Joy_Stick_Port = 12
Keyboard_Port = 13
Mouse_Port = 14
SSA_SCSI = 15
USB = 16
FireWire_IEEE_P1394 = 17
PCMCIA_Type_II1 = 18
PCMCIA_Type_II2 = 19
PCMCIA_Type_III = 20
Cardbus = 21
Access_Bus_Port = 22
SCSI_II = 23
SCSI_Wide = 24
PC_98 = 25
PC_98_Hireso = 26
PC_H98 = 27
Video_Port = 28
Audio_Port = 29
Modem_Port = 30
Network_Port = 31
_8251_Compatible = 32
_8251_FIFO_Compatible = 33
}
#endregion define enum
# get one instance:
$instance = Get-CimInstance -Class Win32_PortConnector | Select-Object -First 1
<#
IMPORTANT: this example processes only one instance to focus on
the number-to-text type conversion.
To process all instances, replace "Select-Object -First 1"
with a "Foreach-Object" loop, and use the iterator variable
$_ instead of $instance
#>
# query the property:
$rawValue = $instance.PortType
#region using strict type conversion
<#
Note: strict type conversion fails if the raw value is
not defined by the enum. So if the list of allowable values
was extended and the enum does not match the value,
an exception is thrown
#>
# convert the property to the enum **PortType**
[EnumPortType]$rawValue
# get a comma-separated string:
[EnumPortType]$rawValue -join ','
#endregion
#region using operator "-as"
<#
Note: the operator "-as" accepts values not defined
by the enum and returns $null instead of throwing
an exception
#>
$rawValue -as [EnumPortType]
#endregion
Enums must cover all possible values. If PortType returns a value that is not defined in the enum, an exception occurs. The exception reports the value that was missing in the enum. To fix, add the missing value to the enum.
PoweredOn
If TRUE, the physical element is powered on.
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, PoweredOn
SerialNumber
Manufacturer-allocated number used to identify a physical element.
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, SerialNumber
SKU
Stock keeping unit number for a physical element.
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, SKU
Status
Current status of an object. Various operational and nonoperational statuses can be defined. Available values:
$values = 'Degraded','Error','Lost Comm','No Contact','NonRecover','OK','Pred Fail','Service','Starting','Stopping','Stressed','Unknown'
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, Status
Tag
KEY PROPERTY STRING MAX 256 CHAR
Unique identifier of a port connection on the computer system.
Example: “Port Connector 1”
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag
Version
Version of the physical element.
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property Tag, Version
Examples
List all instances of Win32_PortConnector
Get-CimInstance -ClassName Win32_PortConnector
Learn more about Get-CimInstance
and the deprecated Get-WmiObject
.
View all properties
Get-CimInstance -ClassName Win32_PortConnector -Property *
View key properties only
Get-CimInstance -ClassName Win32_PortConnector -KeyOnly
Selecting Properties
To select only some properties, pipe the results to Select-Object -Property a,b,c
with a comma-separated list of the properties you require. Wildcards are permitted.
Get-CimInstance
always returns all properties but only retrieves the ones that you specify. All other properties are empty but still present. That’s why you need to pipe the results into Select-Object
if you want to limit the visible properties, i.e. for reporting.
Selecting Properties
The code below lists all available properties. Remove the ones you do not need:
$properties = 'Caption',
'ConnectorPinout',
'ConnectorType',
'CreationClassName',
'Description',
'ExternalReferenceDesignator',
'InstallDate',
'InternalReferenceDesignator',
'Manufacturer',
'Model',
'Name',
'OtherIdentifyingInfo',
'PartNumber',
'PortType',
'PoweredOn',
'SerialNumber',
'SKU',
'Status',
'Tag',
'Version'
Get-CimInstance -ClassName Win32_PortConnector | Select-Object -Property $properties
Limiting Network Bandwidth
If you work remotely, it makes sense to limit network bandwidth by filtering the properties on the server side, too:
Get-CimInstance -Class Win32_PortConnector -Property $property |
Select-Object -Property $property
Selecting Instances
To select some instances, use Get-CimInstance and a WMI Query. The wildcard character in WMI Queries is % (and not “*”).
The parameter -Filter runs a simple query.
Listing all instances where the property Caption starts with “A”
Get-CimInstance -Class Win32_PortConnector -Filter 'Caption LIKE "a%"'
Using a WQL Query
The parameter -Query uses a query similar to SQL and combines the parameters -Filter and -Property. This returns all instances where the property Caption starts with “A”, and returns the properties specified:
Get-CimInstance -Query "SELECT Name, CreationClassName, Caption, ConnectorPinout FROM Win32_PortConnector WHERE Caption LIKE 'a%'"
Any property you did not specify is still present but empty. You might need to use
Select-Object
to remove all unwanted properties:Get-CimInstance -Query "SELECT Name, CreationClassName, Caption, ConnectorPinout FROM Win32_PortConnector WHERE Caption LIKE 'a%'" | Select-Object -Property Name, CreationClassName, Caption, ConnectorPinout
Accessing Remote Computers
To access remote systems, you need to have proper permissions. User the parameter -ComputerName to access one or more remote systems.
Authenticating as Current User
# one or more computer names or IP addresses:
$list = 'server1', 'server2'
# authenticate with your current identity:
$result = Get-CimInstance -ClassName Win32_PortConnector -ComputerName $list
$result
Authenticating as Different User
Use a CIMSession object to authenticate with a new identity:
# one or more computer names or IP addresses:
$list = 'server1', 'server2'
# authenticate with a different identity:
$cred = Get-Credential -Message 'Authenticate to retrieve WMI information:'
$session = New-CimSession -ComputerName $list -Credential $cred
$result = Get-CimInstance Win32_PortConnector -CimSession $session
# remove the session after use (if you do not plan to re-use it later)
Remove-CimSession -CimSession $session
$result
Learn more about accessing remote computers.
Requirements
To use Win32_PortConnector, the following requirements apply:
PowerShell
Get-CimInstance
was introduced with PowerShell Version 3.0, which in turn was introduced on clients with Windows 8 and on servers with Windows Server 2012.
If necessary, update Windows PowerShell to Windows PowerShell 5.1, or install PowerShell 7 side-by-side.
Operating System
Win32_PortConnector was introduced on clients with Windows Vista and on servers with Windows Server 2008.
Namespace
Win32_PortConnector lives in the Namespace Root/CIMV2. This is the default namespace. There is no need to use the -Namespace parameter in Get-CimInstance
.
Implementation
Win32_PortConnector is implemented in CIMWin32.dll and defined in CIMWin32.mof. Both files are located in the folder C:\Windows\system32\wbem
:
explorer $env:windir\system32\wbem
notepad $env:windir\system32\wbem\CIMWin32.mof