If you’d like to generate super large files for stress test purposes, you don’t have to waste time pumping data into a file to make it grow. Instead, simply set the desired file size to reserve the space on disk.

This creates a 1GB test file:

 # create a test file
 $path = "$env:temp\dummyFile.txt"
 $file = [System.IO.File]::Create($path)

 # set the file size (file uses random content)
 $file.SetLength(1gb)
 $file.Close()

 # view file properties
 Get-Item $path 

Twitter This Tip! ReTweet this Tip!

Anonymous