Creating Dummy Test Files

by Sep 10, 2021

If you need to test file system load, test failover clusters, or need large dummy files otherwise, rather than creating new files and slowly filling them with random data, try this:

$filepath = "$env:temp\testfile.txt"
$sizeBytes = 5.75MB

$file = [System.IO.File]::Create($filepath)

# show dummy file in Windows Explorer
explorer /select,$filepath

This code creates dummy files of any size in a snap and can be used to quickly create storage load. Just don’t forget to delete these files after use.

Twitter This Tip! ReTweet this Tip!