PowerShell OneLiner To Almost Fill Up Your Hard Drive Print E-mail
Written by Darwin Sanoy   
Thursday, May 8, 2014 2:49pm
What possible use could you have for almost filling up your hard drive?  Read on to find out...

For testing whether your free hard drive space testing code works of course!

But you could also do that by expanding it's threshold to be larger than your free space - so it's just for fun :)

The following line takes you down to 3 GB of free space.  You may have to end the PowerShell prompt where you use this code in order to release the file for deletion.

[io.file]::Create("$env:temp\reallybigfile-deleteme.txt").SetLength((gwmi Win32_LogicalDisk -Filter "DeviceID='C:'").FreeSpace - 3GB).Close