February 2019
Intermediate to advanced
626 pages
15h 51m
English
Assigning a statement to the null variable is a popular way of dropping unwanted output. It has the advantage of being obvious, in that it appears at the beginning of the statement. This method is fast in all versions of PowerShell:
using namespace System.Text$stringBuilder = [StringBuilder]::new()$null = $stringBuilder.AppendFormat('Name: {0}', $service.Name).AppendLine(). AppendFormat('Status: {0}', $service.Status).AppendLine(). AppendLine()$stringBuilder.ToString()
Read now
Unlock full access