Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 4.0 » Write-Error

Write-Error - Powershell 4.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Write-Error

Short description
Writes an object to the error stream.

Syntax


Description
The Write-Error cmdlet declares a non-terminating error. By default, errors are sent in the error stream to the host 
program to be displayed, along with output.


To write a non-terminating error, enter an error message string, an ErrorRecord object, or an Exception object.  Use 
the other parameters of Write-Error to populate the error record.


Non-terminating errors write an error to the error stream, but they do not stop command processing. If a 
non-terminating error is declared on one item in a collection of input items, the command continues to process the 
other items in the collection.


To declare a terminating error, use the Throw keyword. For more information, see about_Throw 
(http://go.microsoft.com/fwlink/?LinkID=145153).