Quickly Generate Hex Range with PowerShell

While participating in a recent SANS NetWars, I needed to iterate through a range of hex values and found a quick way to achieve this via PowerShell.

Creates an array from 00 to ff.

00..0xff | % ToString X2

Creates an array from 0000 to ffff.

0000..0xffff | % ToString X4

Creates an array from 0000 to 00ff.

00..0xff | % ToString X4

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.