Non-standard output

In PowerShell there are other output streams; these include error (Write-Error), information (Write-Information, introduced in PowerShell 5), warning (Write-Warning), and Verbose (Write-Verbose). PowerShell also has Write-Host, which displays information to the PowerShell host (the console, or PowerShell ISE). Each of these has a stream of its own.

For example, if the Verbose switch is added to the preceding command, more information is shown. This extra information is not held in the variable, it is sent to a different stream:

PS> $stdout = Get-CimInstance Win32_ComputerSystem -Verbose
$stdout
VERBOSE: Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = rootcimv2,'className' = Win32_ComputerSystem'.
VERBOSE: Operation 'Enumerate CimInstances' complete.
Name PrimaryOwnerName Domain TotalPhysicalMemory Model
---- ---------------- ------ ------------------- -----
TITAN Chris WORKGROUP 17076875264 All Series
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset