$var1 = [byte]0xDB,0x01,0x00,0x00,0x10,0x00,0x00,0x00,0x01,0x01,0x02,0x04,0xF4,0x00,0x00,0x00
$var2 = [byte]0xDB,0x01,0x00,0x00,0x10,0x00,0x00,0x00,0x01,0x01,0x00,0x03,0xF1,0x00,0x00,0x00
$value = Get-ItemProperty -Path $path | Select-Object -ExpandProperty $name -ErrorAction SilentlyContinue
switch ($value)
$var1 {act1}
$var2 {act2}
This command
Get-ItemProperty -Path $path | Select-Object -ExpandProperty $name -ErrorAction SilentlyContinue outputs:
219 1 0 0 16 0 0 0 1 1 0 4 242 0 0 0
But apparently switch only works if the output in such form:
[byte]0xDB,0x01,0x00,0x00,0x10,0x00,0x00,0x00,0x01,0x01,0x00,0x03,0xF1,0x00,0x00,0x00
So I need somehow convert one of those variables for the switch to work or maybe use different commands
[byte[]] (0xDB,0x01,…). In your examples, only the first element of the array will be of type byte.switch ("$value")"$var1" {act1}"$var2" {act2}