System.BitConverter allows to convert base types to byte arrays and vice versa. GetBytes(val) is overloaded for various base types and returns the base type's internal byte representation with which it stores val. ToX(byteArray) convert byteArray to the base type X (for example ToInt32()). [int32] $int_32 = 4100 [byte[]] $bytes = [System.BitConverter]::GetBytes($int_32) $bytes -join ', ' # # 4, 16, 0, 0
ToX methods in System.Convert that convert certain values to intergral numeric types.