How to generate a sample data test file using PowerShell

Using PowerShell, you can quickly create a test file on your computer. I use these for testing SharePoint attachment upload sizes.

You can generate files in mb, gb, etc. easily. This example generates a 5gb test file in  C:\Users\MyUserName\AppData\Local\Temp called testfile.txt

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

5gb test file

Example of the above file uploaded to SP using drag and drop:

5gb sharepoint drag and drop

Leave a Reply

%d bloggers like this: