AD | Application | AWS | Azure | Cloud | Database | Enterprise | Environmental | Event Log | File System | IoT | IT Service | Network/System | NIS2 | Infra | Performance | Protocol | SaaS | Security | Service Level | Storage | Linux | VMware | VoIP | Web | Wireless | SNMP

MonitorTools.com » Administration » Powershell » Powershell 3.0 » Write-Error

Write-Error - Powershell 3.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 pr
ogram 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 th
e 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-terminatin
g 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/f
wlink/?LinkID=145153).





M