-
-
Save p0shkatz/f1b170acd0e9dcab6616dfe5861a8c32 to your computer and use it in GitHub Desktop.
powershell disk filler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# File to create/update | |
$filePath = "$($env:userprofile)\Desktop\large-test-file.txt" | |
$hFile = [System.IO.File]::OpenWrite($filePath) | |
# Lynch pin file to stop process | |
$lpFilePath = "$($env:userprofile)\Desktop\lynch.pin" | |
$hLpFile = [System.IO.File]::OpenWrite($lpFilePath) | |
$hLpFile.Close() | |
# Target System drive | |
$driveInfo = New-Object System.IO.DriveInfo($env:SystemDrive) | |
while([System.IO.File]::Exists($lpFilePath)) | |
{ | |
$hFile.SetLength($hFile.Length + $driveInfo.AvailableFreeSpace) | |
} | |
# Cleanup | |
$hFile.Close() | |
[System.IO.File]::Delete($filePath) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment