Stop script from repeating

Excuse the formatting.

The script takes about a minute to run. I’m displaying the results within a RichTextBox inside a GUI. While the script is parsing through the OU, it repeats the servers that it does find with less than 10GB, until the script completes. I need it to display what servers it finds just once. I’ve tried Break and Continue which don’t work.


P.S. I know I need to update the code to use Get-CIMInstance and Win32_Volume

Never mind, I figured it out. I had my Add-RichTextBox $results in the wrong place.

Please post the script here or use gist, it will be difficult for anyone to open another link to go through your script.

Please not that, you are iterating through all the computers in the domain.
-ComputerName parameter takes array of strings, hence you could avoid using Foreach loop.

Get-PSDrive shows free space too.