![]() |
I AM THE FUNNY!!! |
---|
Filling up the hard drive... what could possibly go wrong?
So this just creates a file that is a size specified by you. It doesn't check to see how much size is on the server / computer and is fairly simple.
<#
.SYNOPSIS <A detailed description of the script> .PARAMETER <paramName> <Description of script parameter> .EXAMPLE <An example of using the script> #> $NumberFiles = Read-host -Prompt 'Enter number of files to create' $NumberStart = Read-host -Prompt 'Enter number to start from (if there are already filler files)' $FileLocation = Read-host -Prompt 'Enter location files will be created (do not include \ at the end of the path)' $FileSize = Read-host -Prompt 'Enter file size, e.g. 2GB' If($NumberStart -le 1){ $CountMe = 0 $NumberFilesStop = $NumberFiles }ElseIf($NumberStart -gt 1){ [int]$CountMe = [int]$NumberStart - 1 [int]$NumberFilesStop = [int]$NumberFiles + [int]$NumberStart - 1 } Do { $CountMe = $CountMe + 1 $FileToCreate = $FileLocation + '\filler' + $CountMe + '.dat' $File = new-object System.IO.FileStream $FileToCreate, Create, ReadWrite $File.SetLength((Invoke-Expression $FileSize)) $File.Close() } Until($CountMe -eq $NumberFilesStop) |