The following block of code creates an temp file with a fixed file size.

So in the example below the file size is 3MB

The size should be in KB

$file = [System.IO.File]::Create("C:\TempFile.tmp")
    $file.SetLength("3145728") #3MB
    $file.Close()

I used this method with a ForEach loop to generate alot of files and test my Failover Cluster.

Rate this post