Creating Large Dummy Files With .NET

by Mar 11, 2010

You can always resort to the underlying .NET framework whenever the functionality you need isn't available through a cmdlet.

The following code is a very fast way to generate really large test files:

$path = "$env:temp\testfile.txt"
$file = [io.file]::Create($path)
$file.SetLength(1gb)
$file.Close()
Get-Item $path

Twitter This Tip! ReTweet this Tip!