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

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.