Useful when making junk files to test transfer speeds & such.
# Define the size of the file in megabytes
$FileSize = 50
#Convert into bytes for calculation
$FileSize = $FileSize * 1024 * 1024
# Define the path and name of the file
$filePath = "C:\path\to\your\file.txt"
# Create a file with the specified size
$fs = [System.IO.File]::Create($filePath)
$fs.SetLength($fileSize)
$fs.Close()
Write-Output "File created at $filePath with size $fileSize megabytes"