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.
TIA
P.S. I know I need to update the code to use Get-CIMInstance and Win32_Volume
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.