Sometimes there is a need to test bandwidth of Windows network or disk subsystem. Usually it’s a hassle to find and transfer large enough incompressable files onto the server to perform an accurate speed test.

The following PowerShell code creates multiple 1GB files with random content. I my case the files were barely compressible, ideal for testing WAN link performance without worrying that WAN Optimizers will affect the test result.

To change number of generated files adjust the “-le 100” part.

for ($i=1; $i -le 100; $i++)
{
    $out = new-object byte[] 1073741824; (new-object Random).NextBytes($out);           [IO.File]::WriteAllBytes("c:\file$i.txt", $out)
}