The Win32_DMAChannel WMI class represents a direct memory access (DMA) channel on a computer system running Windows. DMA is a method of moving data from a device to memory (or vice versa) without the help of the microprocessor. The system board uses a DMA controller to handle a fixed number of channels, each of which can be used by one (and only one) device at a time.
Methods
Win32_DMAChannel has no methods.
Properties
Win32_DMAChannel returns 19 properties:
'AddressSize','Availability','BurstMode','ByteMode','Caption','ChannelTiming',
'CreationClassName','CSCreationClassName','CSName','Description','DMAChannel','InstallDate',
'MaxTransferSize','Name','Port','Status','TransferWidths','TypeCTiming','WordMode'
Unless explicitly marked as writeable, all properties are read-only. Read all properties for all instances:
Get-CimInstance -ClassName Win32_DMAChannel -Property *
Most WMI classes return one or more instances.
When
Get-CimInstance
returns no result, then apparently no instances of class Win32_DMAChannel 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).
AddressSize
DMA channel address size in bits. Permissible values are 8, 16, 32, or 64 bits. If unknown, enter 0 (zero).
(0)
(8)
(16)
(32)
(64)
Get-CimInstance -ClassName Win32_DMAChannel | Select-Object -Property DMAChannel, AddressSize
Availability
Availability returns a numeric value. To translate it into a meaningful text, use any of the following approaches:
Use a PowerShell Hashtable
$Availability_map = @{
1 = 'Other'
2 = 'Unknown'
3 = 'Available'
4 = 'In Use/Not Available'
5 = 'In Use and Available/Shareable'
}
Use a switch statement
switch([int]$value)
{
1 {'Other'}
2 {'Unknown'}
3 {'Available'}
4 {'In Use/Not Available'}
5 {'In Use and Available/Shareable'}
default {"$value"}
}
Use Enum structure
Enum EnumAvailability
{
Other = 1
Unknown = 2
Available = 3
In_UseNot_Available = 4
In_Use_and_AvailableShareable = 5
}
Examples
Use $Availability_map in a calculated property for Select-Object
<#
this example uses a hashtable to translate raw numeric values for
property "Availability" to friendly text
Note: to use other properties than "Availability", 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 "Availability"
# to translate other properties, use their translation table instead
$Availability_map = @{
1 = 'Other'
2 = 'Unknown'
3 = 'Available'
4 = 'In Use/Not Available'
5 = 'In Use and Available/Shareable'
}
#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 "Availability", 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:
#>
$Availability = @{
Name = 'Availability'
Expression = {
# property is an array, so process all values
$value = $_.Availability
$Availability_map[[int]$value]
}
}
#endregion define calculated property
# retrieve the instances, and output the properties "Caption" and "Availability". The latter
# is defined by the hashtable in $Availability:
Get-CimInstance -Class Win32_DMAChannel | Select-Object -Property Caption, $Availability
# ...or dump content of property Availability:
$friendlyValues = Get-CimInstance -Class Win32_DMAChannel |
Select-Object -Property $Availability |
Select-Object -ExpandProperty Availability
# output values
$friendlyValues
# output values as comma separated list
$friendlyValues -join ', '
# output values as bullet list
$friendlyValues | ForEach-Object { "- $_" }
Use $Availability_map to directly translate raw values from an instance
<#
this example uses a hashtable to manually translate raw numeric values
for property "Win32_DMAChannel" to friendly text. This approach is ideal when
there is just one instance to work with.
Note: to use other properties than "Win32_DMAChannel", 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_DMAChannel"
# to translate other properties, use their translation table instead
$Availability_map = @{
1 = 'Other'
2 = 'Unknown'
3 = 'Available'
4 = 'In Use/Not Available'
5 = 'In Use and Available/Shareable'
}
#endregion define hashtable
# get one instance:
$instance = Get-CimInstance -Class Win32_DMAChannel | 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.Availability
# translate raw value to friendly text:
$friendlyName = $Availability_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 "Availability" 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 "Availability", 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 "Availability", 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:
#>
$Availability = @{
Name = 'Availability'
Expression = {
# property is an array, so process all values
$value = $_.Availability
switch([int]$value)
{
1 {'Other'}
2 {'Unknown'}
3 {'Available'}
4 {'In Use/Not Available'}
5 {'In Use and Available/Shareable'}
default {"$value"}
}
}
}
#endregion define calculated property
# retrieve all instances...
Get-CimInstance -ClassName Win32_DMAChannel |
# ...and output properties "Caption" and "Availability". The latter is defined
# by the hashtable in $Availability:
Select-Object -Property Caption, $Availability
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_DMAChannel", look up the appropriate
enum definition for the property you would like to use instead.
#>
#region define enum with value-to-text translation:
Enum EnumAvailability
{
Other = 1
Unknown = 2
Available = 3
In_UseNot_Available = 4
In_Use_and_AvailableShareable = 5
}
#endregion define enum
# get one instance:
$instance = Get-CimInstance -Class Win32_DMAChannel | 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.Availability
#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 **Availability**
[EnumAvailability]$rawValue
# get a comma-separated string:
[EnumAvailability]$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 [EnumAvailability]
#endregion
Enums must cover all possible values. If Availability 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.
BurstMode
Indicates whether or not the DMA channel supports burst mode.
Get-CimInstance -ClassName Win32_DMAChannel | Select-Object -Property DMAChannel, BurstMode
ByteMode
DMA execution mode.
ByteMode returns a numeric value. To translate it into a meaningful text, use any of the following approaches:
Use a PowerShell Hashtable
$ByteMode_map = @{
1 = 'Other'
2 = 'Unknown'
3 = 'Not execute in ''count by byte'' mode'
4 = 'Execute in ''count by byte'' mode'
}
Use a switch statement
switch([int]$value)
{
1 {'Other'}
2 {'Unknown'}
3 {'Not execute in ''count by byte'' mode'}
4 {'Execute in ''count by byte'' mode'}
default {"$value"}
}
Use Enum structure
Enum EnumByteMode
{
Other = 1
Unknown = 2
Not_execute_in_count_by_byte_mode = 3
Execute_in_count_by_byte_mode = 4
}
Examples
Use $ByteMode_map in a calculated property for Select-Object
<#
this example uses a hashtable to translate raw numeric values for
property "ByteMode" to friendly text
Note: to use other properties than "ByteMode", 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 "ByteMode"
# to translate other properties, use their translation table instead
$ByteMode_map = @{
1 = 'Other'
2 = 'Unknown'
3 = 'Not execute in ''count by byte'' mode'
4 = 'Execute in ''count by byte'' mode'
}
#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 "ByteMode", 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:
#>
$ByteMode = @{
Name = 'ByteMode'
Expression = {
# property is an array, so process all values
$value = $_.ByteMode
$ByteMode_map[[int]$value]
}
}
#endregion define calculated property
# retrieve the instances, and output the properties "Caption" and "ByteMode". The latter
# is defined by the hashtable in $ByteMode:
Get-CimInstance -Class Win32_DMAChannel | Select-Object -Property Caption, $ByteMode
# ...or dump content of property ByteMode:
$friendlyValues = Get-CimInstance -Class Win32_DMAChannel |
Select-Object -Property $ByteMode |
Select-Object -ExpandProperty ByteMode
# output values
$friendlyValues
# output values as comma separated list
$friendlyValues -join ', '
# output values as bullet list
$friendlyValues | ForEach-Object { "- $_" }
Use $ByteMode_map to directly translate raw values from an instance
<#
this example uses a hashtable to manually translate raw numeric values
for property "Win32_DMAChannel" to friendly text. This approach is ideal when
there is just one instance to work with.
Note: to use other properties than "Win32_DMAChannel", 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_DMAChannel"
# to translate other properties, use their translation table instead
$ByteMode_map = @{
1 = 'Other'
2 = 'Unknown'
3 = 'Not execute in ''count by byte'' mode'
4 = 'Execute in ''count by byte'' mode'
}
#endregion define hashtable
# get one instance:
$instance = Get-CimInstance -Class Win32_DMAChannel | 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.ByteMode
# translate raw value to friendly text:
$friendlyName = $ByteMode_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 "ByteMode" 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 "ByteMode", 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 "ByteMode", 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:
#>
$ByteMode = @{
Name = 'ByteMode'
Expression = {
# property is an array, so process all values
$value = $_.ByteMode
switch([int]$value)
{
1 {'Other'}
2 {'Unknown'}
3 {'Not execute in ''count by byte'' mode'}
4 {'Execute in ''count by byte'' mode'}
default {"$value"}
}
}
}
#endregion define calculated property
# retrieve all instances...
Get-CimInstance -ClassName Win32_DMAChannel |
# ...and output properties "Caption" and "ByteMode". The latter is defined
# by the hashtable in $ByteMode:
Select-Object -Property Caption, $ByteMode
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_DMAChannel", look up the appropriate
enum definition for the property you would like to use instead.
#>
#region define enum with value-to-text translation:
Enum EnumByteMode
{
Other = 1
Unknown = 2
Not_execute_in_count_by_byte_mode = 3
Execute_in_count_by_byte_mode = 4
}
#endregion define enum
# get one instance:
$instance = Get-CimInstance -Class Win32_DMAChannel | 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.ByteMode
#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 **ByteMode**
[EnumByteMode]$rawValue
# get a comma-separated string:
[EnumByteMode]$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 [EnumByteMode]
#endregion
Enums must cover all possible values. If ByteMode 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.
Caption
Short description of the object a one-line string.
Get-CimInstance -ClassName Win32_DMAChannel | Select-Object -Property DMAChannel, Caption
ChannelTiming
DMA channel timing.
ChannelTiming returns a numeric value. To translate it into a meaningful text, use any of the following approaches:
Use a PowerShell Hashtable
$ChannelTiming_map = @{
1 = 'Other'
2 = 'Unknown'
3 = 'ISA Compatible'
4 = 'Type A'
5 = 'Type B'
6 = 'Type F'
}
Use a switch statement
switch([int]$value)
{
1 {'Other'}
2 {'Unknown'}
3 {'ISA Compatible'}
4 {'Type A'}
5 {'Type B'}
6 {'Type F'}
default {"$value"}
}
Use Enum structure
Enum EnumChannelTiming
{
Other = 1
Unknown = 2
ISA_Compatible = 3
Type_A = 4
Type_B = 5
Type_F = 6
}
Examples
Use $ChannelTiming_map in a calculated property for Select-Object
<#
this example uses a hashtable to translate raw numeric values for
property "ChannelTiming" to friendly text
Note: to use other properties than "ChannelTiming", 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 "ChannelTiming"
# to translate other properties, use their translation table instead
$ChannelTiming_map = @{
1 = 'Other'
2 = 'Unknown'
3 = 'ISA Compatible'
4 = 'Type A'
5 = 'Type B'
6 = 'Type F'
}
#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 "ChannelTiming", 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:
#>
$ChannelTiming = @{
Name = 'ChannelTiming'
Expression = {
# property is an array, so process all values
$value = $_.ChannelTiming
$ChannelTiming_map[[int]$value]
}
}
#endregion define calculated property
# retrieve the instances, and output the properties "Caption" and "ChannelTiming". The latter
# is defined by the hashtable in $ChannelTiming:
Get-CimInstance -Class Win32_DMAChannel | Select-Object -Property Caption, $ChannelTiming
# ...or dump content of property ChannelTiming:
$friendlyValues = Get-CimInstance -Class Win32_DMAChannel |
Select-Object -Property $ChannelTiming |
Select-Object -ExpandProperty ChannelTiming
# output values
$friendlyValues
# output values as comma separated list
$friendlyValues -join ', '
# output values as bullet list
$friendlyValues | ForEach-Object { "- $_" }
Use $ChannelTiming_map to directly translate raw values from an instance
<#
this example uses a hashtable to manually translate raw numeric values
for property "Win32_DMAChannel" to friendly text. This approach is ideal when
there is just one instance to work with.
Note: to use other properties than "Win32_DMAChannel", 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_DMAChannel"
# to translate other properties, use their translation table instead
$ChannelTiming_map = @{
1 = 'Other'
2 = 'Unknown'
3 = 'ISA Compatible'
4 = 'Type A'
5 = 'Type B'
6 = 'Type F'
}
#endregion define hashtable
# get one instance:
$instance = Get-CimInstance -Class Win32_DMAChannel | 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.ChannelTiming
# translate raw value to friendly text:
$friendlyName = $ChannelTiming_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 "ChannelTiming" 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 "ChannelTiming", 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 "ChannelTiming", 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:
#>
$ChannelTiming = @{
Name = 'ChannelTiming'
Expression = {
# property is an array, so process all values
$value = $_.ChannelTiming
switch([int]$value)
{
1 {'Other'}
2 {'Unknown'}
3 {'ISA Compatible'}
4 {'Type A'}
5 {'Type B'}
6 {'Type F'}
default {"$value"}
}
}
}
#endregion define calculated property
# retrieve all instances...
Get-CimInstance -ClassName Win32_DMAChannel |
# ...and output properties "Caption" and "ChannelTiming". The latter is defined
# by the hashtable in $ChannelTiming:
Select-Object -Property Caption, $ChannelTiming
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_DMAChannel", look up the appropriate
enum definition for the property you would like to use instead.
#>
#region define enum with value-to-text translation:
Enum EnumChannelTiming
{
Other = 1
Unknown = 2
ISA_Compatible = 3
Type_A = 4
Type_B = 5
Type_F = 6
}
#endregion define enum
# get one instance:
$instance = Get-CimInstance -Class Win32_DMAChannel | 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.ChannelTiming
#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 **ChannelTiming**
[EnumChannelTiming]$rawValue
# get a comma-separated string:
[EnumChannelTiming]$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 [EnumChannelTiming]
#endregion
Enums must cover all possible values. If ChannelTiming 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 to appear 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 uniquely identified.
Get-CimInstance -ClassName Win32_DMAChannel | Select-Object -Property DMAChannel, CreationClassName
CSCreationClassName
Name of the scoping computer system creation class.
Get-CimInstance -ClassName Win32_DMAChannel | Select-Object -Property DMAChannel, CSCreationClassName
CSName
Name of the scoping computer system.
Get-CimInstance -ClassName Win32_DMAChannel | Select-Object -Property DMAChannel, CSName
Description
Description of the object.
Get-CimInstance -ClassName Win32_DMAChannel | Select-Object -Property DMAChannel, Description
DMAChannel
DMA channel number, part of the object’s key value.
Get-CimInstance -ClassName Win32_DMAChannel | Select-Object -Property DMAChannel
InstallDate
Date and time the object was installed. This property does not need a value to indicate that the object is installed.
Get-CimInstance -ClassName Win32_DMAChannel | Select-Object -Property DMAChannel, InstallDate
MaxTransferSize
Maximum number of bytes that can be transferred by this DMA channel. If unknown, enter 0 (zero).
Get-CimInstance -ClassName Win32_DMAChannel | Select-Object -Property DMAChannel, MaxTransferSize
Name
Label by which the object is known. When subclassed, the property can be overridden to be a key property.
Get-CimInstance -ClassName Win32_DMAChannel | Select-Object -Property DMAChannel, Name
Port
DMA port used by the host bus adapter. This is meaningful for MCA-type buses.
Example: 12
Get-CimInstance -ClassName Win32_DMAChannel | Select-Object -Property DMAChannel, Port
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_DMAChannel | Select-Object -Property DMAChannel, Status
TransferWidths
Array of all the transfer widths (in bits) supported by this DMA channel. If unknown, enter 0 (zero).
(0)
(8)
(16)
(32)
(64)
(128)
Get-CimInstance -ClassName Win32_DMAChannel | Select-Object -Property DMAChannel, TransferWidths
TypeCTiming
Support for C type (burst) timing.
TypeCTiming returns a numeric value. To translate it into a meaningful text, use any of the following approaches:
Use a PowerShell Hashtable
$TypeCTiming_map = @{
1 = 'Other'
2 = 'Unknown'
3 = 'ISA Compatible'
4 = 'Not Supported'
5 = 'Supported'
}
Use a switch statement
switch([int]$value)
{
1 {'Other'}
2 {'Unknown'}
3 {'ISA Compatible'}
4 {'Not Supported'}
5 {'Supported'}
default {"$value"}
}
Use Enum structure
Enum EnumTypeCTiming
{
Other = 1
Unknown = 2
ISA_Compatible = 3
Not_Supported = 4
Supported = 5
}
Examples
Use $TypeCTiming_map in a calculated property for Select-Object
<#
this example uses a hashtable to translate raw numeric values for
property "TypeCTiming" to friendly text
Note: to use other properties than "TypeCTiming", 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 "TypeCTiming"
# to translate other properties, use their translation table instead
$TypeCTiming_map = @{
1 = 'Other'
2 = 'Unknown'
3 = 'ISA Compatible'
4 = 'Not Supported'
5 = 'Supported'
}
#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 "TypeCTiming", 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:
#>
$TypeCTiming = @{
Name = 'TypeCTiming'
Expression = {
# property is an array, so process all values
$value = $_.TypeCTiming
$TypeCTiming_map[[int]$value]
}
}
#endregion define calculated property
# retrieve the instances, and output the properties "Caption" and "TypeCTiming". The latter
# is defined by the hashtable in $TypeCTiming:
Get-CimInstance -Class Win32_DMAChannel | Select-Object -Property Caption, $TypeCTiming
# ...or dump content of property TypeCTiming:
$friendlyValues = Get-CimInstance -Class Win32_DMAChannel |
Select-Object -Property $TypeCTiming |
Select-Object -ExpandProperty TypeCTiming
# output values
$friendlyValues
# output values as comma separated list
$friendlyValues -join ', '
# output values as bullet list
$friendlyValues | ForEach-Object { "- $_" }
Use $TypeCTiming_map to directly translate raw values from an instance
<#
this example uses a hashtable to manually translate raw numeric values
for property "Win32_DMAChannel" to friendly text. This approach is ideal when
there is just one instance to work with.
Note: to use other properties than "Win32_DMAChannel", 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_DMAChannel"
# to translate other properties, use their translation table instead
$TypeCTiming_map = @{
1 = 'Other'
2 = 'Unknown'
3 = 'ISA Compatible'
4 = 'Not Supported'
5 = 'Supported'
}
#endregion define hashtable
# get one instance:
$instance = Get-CimInstance -Class Win32_DMAChannel | 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.TypeCTiming
# translate raw value to friendly text:
$friendlyName = $TypeCTiming_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 "TypeCTiming" 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 "TypeCTiming", 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 "TypeCTiming", 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:
#>
$TypeCTiming = @{
Name = 'TypeCTiming'
Expression = {
# property is an array, so process all values
$value = $_.TypeCTiming
switch([int]$value)
{
1 {'Other'}
2 {'Unknown'}
3 {'ISA Compatible'}
4 {'Not Supported'}
5 {'Supported'}
default {"$value"}
}
}
}
#endregion define calculated property
# retrieve all instances...
Get-CimInstance -ClassName Win32_DMAChannel |
# ...and output properties "Caption" and "TypeCTiming". The latter is defined
# by the hashtable in $TypeCTiming:
Select-Object -Property Caption, $TypeCTiming
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_DMAChannel", look up the appropriate
enum definition for the property you would like to use instead.
#>
#region define enum with value-to-text translation:
Enum EnumTypeCTiming
{
Other = 1
Unknown = 2
ISA_Compatible = 3
Not_Supported = 4
Supported = 5
}
#endregion define enum
# get one instance:
$instance = Get-CimInstance -Class Win32_DMAChannel | 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.TypeCTiming
#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 **TypeCTiming**
[EnumTypeCTiming]$rawValue
# get a comma-separated string:
[EnumTypeCTiming]$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 [EnumTypeCTiming]
#endregion
Enums must cover all possible values. If TypeCTiming 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.
WordMode
DMA execution mode.
WordMode returns a numeric value. To translate it into a meaningful text, use any of the following approaches:
Use a PowerShell Hashtable
$WordMode_map = @{
1 = 'Other'
2 = 'Unknown'
3 = 'Not execute in ''count by word'' mode'
4 = 'Execute in ''count by word'' mode'
}
Use a switch statement
switch([int]$value)
{
1 {'Other'}
2 {'Unknown'}
3 {'Not execute in ''count by word'' mode'}
4 {'Execute in ''count by word'' mode'}
default {"$value"}
}
Use Enum structure
Enum EnumWordMode
{
Other = 1
Unknown = 2
Not_execute_in_count_by_word_mode = 3
Execute_in_count_by_word_mode = 4
}
Examples
Use $WordMode_map in a calculated property for Select-Object
<#
this example uses a hashtable to translate raw numeric values for
property "WordMode" to friendly text
Note: to use other properties than "WordMode", 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 "WordMode"
# to translate other properties, use their translation table instead
$WordMode_map = @{
1 = 'Other'
2 = 'Unknown'
3 = 'Not execute in ''count by word'' mode'
4 = 'Execute in ''count by word'' mode'
}
#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 "WordMode", 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:
#>
$WordMode = @{
Name = 'WordMode'
Expression = {
# property is an array, so process all values
$value = $_.WordMode
$WordMode_map[[int]$value]
}
}
#endregion define calculated property
# retrieve the instances, and output the properties "Caption" and "WordMode". The latter
# is defined by the hashtable in $WordMode:
Get-CimInstance -Class Win32_DMAChannel | Select-Object -Property Caption, $WordMode
# ...or dump content of property WordMode:
$friendlyValues = Get-CimInstance -Class Win32_DMAChannel |
Select-Object -Property $WordMode |
Select-Object -ExpandProperty WordMode
# output values
$friendlyValues
# output values as comma separated list
$friendlyValues -join ', '
# output values as bullet list
$friendlyValues | ForEach-Object { "- $_" }
Use $WordMode_map to directly translate raw values from an instance
<#
this example uses a hashtable to manually translate raw numeric values
for property "Win32_DMAChannel" to friendly text. This approach is ideal when
there is just one instance to work with.
Note: to use other properties than "Win32_DMAChannel", 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_DMAChannel"
# to translate other properties, use their translation table instead
$WordMode_map = @{
1 = 'Other'
2 = 'Unknown'
3 = 'Not execute in ''count by word'' mode'
4 = 'Execute in ''count by word'' mode'
}
#endregion define hashtable
# get one instance:
$instance = Get-CimInstance -Class Win32_DMAChannel | 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.WordMode
# translate raw value to friendly text:
$friendlyName = $WordMode_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 "WordMode" 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 "WordMode", 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 "WordMode", 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:
#>
$WordMode = @{
Name = 'WordMode'
Expression = {
# property is an array, so process all values
$value = $_.WordMode
switch([int]$value)
{
1 {'Other'}
2 {'Unknown'}
3 {'Not execute in ''count by word'' mode'}
4 {'Execute in ''count by word'' mode'}
default {"$value"}
}
}
}
#endregion define calculated property
# retrieve all instances...
Get-CimInstance -ClassName Win32_DMAChannel |
# ...and output properties "Caption" and "WordMode". The latter is defined
# by the hashtable in $WordMode:
Select-Object -Property Caption, $WordMode
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_DMAChannel", look up the appropriate
enum definition for the property you would like to use instead.
#>
#region define enum with value-to-text translation:
Enum EnumWordMode
{
Other = 1
Unknown = 2
Not_execute_in_count_by_word_mode = 3
Execute_in_count_by_word_mode = 4
}
#endregion define enum
# get one instance:
$instance = Get-CimInstance -Class Win32_DMAChannel | 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.WordMode
#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 **WordMode**
[EnumWordMode]$rawValue
# get a comma-separated string:
[EnumWordMode]$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 [EnumWordMode]
#endregion
Enums must cover all possible values. If WordMode 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.
Examples
List all instances of Win32_DMAChannel
Get-CimInstance -ClassName Win32_DMAChannel
Learn more about Get-CimInstance
and the deprecated Get-WmiObject
.
View all properties
Get-CimInstance -ClassName Win32_DMAChannel -Property *
View key properties only
Get-CimInstance -ClassName Win32_DMAChannel -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 = 'AddressSize',
'Availability',
'BurstMode',
'ByteMode',
'Caption',
'ChannelTiming',
'CreationClassName',
'CSCreationClassName',
'CSName',
'Description',
'DMAChannel',
'InstallDate',
'MaxTransferSize',
'Name',
'Port',
'Status',
'TransferWidths',
'TypeCTiming',
'WordMode'
Get-CimInstance -ClassName Win32_DMAChannel | 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_DMAChannel -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_DMAChannel -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 MaxTransferSize, Description, BurstMode, Status FROM Win32_DMAChannel 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 MaxTransferSize, Description, BurstMode, Status FROM Win32_DMAChannel WHERE Caption LIKE 'a%'" | Select-Object -Property MaxTransferSize, Description, BurstMode, Status
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_DMAChannel -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_DMAChannel -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_DMAChannel, 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_DMAChannel was introduced on clients with Windows Vista and on servers with Windows Server 2008.
Namespace
Win32_DMAChannel 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_DMAChannel 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