Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

How to Generate Large Files using PowerShell

August 19, 2024
in A, Blog, Powershell
0
ADVERTISEMENT

Table of Contents

Generate Large Files using PowerShell

Why we need to generate large files. Below are some situations you may need them:

  • Use dummy files to figure out if there are any bad sectors on your hard drive.
  • Testing your network speed.
  • Ensure that files on your computer or device are deleted beyond recovery and etc.

Regardless of your reasons, here are the ways to create such files in any modern version of Windows. You can find some small and free tools from internet do it. But in this post, we’ll show how to create them with PowerShell or PowerShell Core quickly.

Create a dummy file with the fsutil

All Windows versions since Vista include an executable named fsutil.exe. You can find it in the system folder. This is the native tool from Microsoft. So, we can use it with no risk.

PS C:\> Get-Command fsutil | Format-List

Name            : fsutil.exe
CommandType     : Application
Definition      : C:\Windows\system32\fsutil.exe
Extension       : .exe
Path            : C:\Windows\system32\fsutil.exe
FileVersionInfo : File:             C:\Windows\system32\fsutil.exe
                  InternalName:     fsutil.exe
                  OriginalFilename: fsutil.exe.mui
                  FileVersion:      10.0.22621.2361 (WinBuild.160101.0800)
                  FileDescription:  fsutil.exe
                  Product:          Microsoft® Windows® Operating System
                  ProductVersion:   10.0.22621.2361

For example, we’ll create a zip file with 10GB in sise. The size can be in KB, GB and TB.

fsutil file createNew "C:\temp\test1.zip" (10GB)
Wu1h7mCFrVcxnUQamKTfoqvyxNyBJ1GN9KtXJ6QyHXkPjPPN0j1EJ4jceCgj

Create a large file using PowerShell with .Net

The second way, we can create a dummy file using .Net as follows:

$path = "C:\temp\test.zip"
$size = 1GB
$content = New-Object byte[] $size
(New-Object System.Random).NextBytes($content)
[System.IO.File]::WriteAllBytes($path, $content)
29qhWQL9BEt7Q5SrJUb0vzUpUQexuWCT5BEv13UchN9BTAi1j508p4Kdy6Bj

The different between two methods is the files created with fsultil are empty. For example, we’ll create two small text files as below:

fsutil file createNew "C:\temp\test1.txt" (1MB)

$path = "C:\temp\test.txt"
$size = 1MB
$content = New-Object byte[] $size
(New-Object System.Random).NextBytes($content)
[System.IO.File]::WriteAllBytes($path, $content)

As you can see in the below screenshot, the text file created by fsulti is empty.

e9OHewtsj2v3qQrOdbax8cYNlNw6ltlkNeVZeXXEFNOm4wrVkOAsbXGslBMn

Create multiple dummy files using PowerShell

In case you want to create multiple large files. You can use the for loop in PowerShell to create them. For example, we create eight files with 15GB in size and the file named randomly.

for ($i = 2; $i -lt 10; $i++) {
    fsutil file createNew "C:\temp\test-$(Get-Random).zip" (15GB)
}
LsKKonpNMzxI4GAs3MQaxXbdItG5ziGGWJDoMmQXRS2VVkdaVFkVYWHf3niJ
ADVERTISEMENT

Not a reader? Watch this related video tutorial:

5/5 - (1 vote)
Previous Post

How To Install or Update OpenSSL 3 on CentOS 8 Linux

Next Post

How to Create a Dummy File of Any Size with PowerShell

Related Posts

Images Hidden Due To Mature Content Settings In CivitAI

August 31, 2024

Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

August 20, 2024

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024

How to Remove The Test Mode Watermark Without Disabling Test Mode

July 28, 2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory