Powershell Method – No Screen Output
Do you ever notice that after you run a method in Powershell you often get some screen output that you didn’t want?
Example, calling a StringBuilder’s .Append() method to simply add more text to the string will echo details of the current capacity and remaining capacity of the StringBuilder object to the screen, which ruins your console look if your carefully laying it out
eg.
1 | $StringBuilderObject.Append($alert.Name) |
Will output capacity and remaining space information relating to the StringBuilder object to the screen.
To fix this, add [Void] before the beginning the the line, so it looks like this:
1 | [Void]$StringBuilderObject.Append($alert.Name) |

