SPCmdlet.WriteError Method (Exception, , Object)

Writes the details of non-terminating errors to the screen as an error message and logs the details in a log file.

Namespace:  Microsoft.SharePoint.PowerShell
Assembly:  Microsoft.SharePoint.PowerShell (in Microsoft.SharePoint.PowerShell.dll)


Protected Sub WriteError ( _
    exception As Exception, _
    category As ErrorCategory, _
    target As Object _
Dim exception As Exception
Dim category As ErrorCategory
Dim target As Object

Me.WriteError(exception, category, _
protected void WriteError(
    Exception exception,
    ErrorCategory category,
    Object target


  • exception
    Type: System.Exception

    The exception that indicates the non-terminating error.

  • category
    Type: ErrorCategory

    Literal description of the error.

  • target
    Type: System.Object

    The instance, or its identity, that failed to process.


When this method is called, an error record is sent to the error pipeline and control is then returned to the cmdlet to continue processing.

See Also


SPCmdlet Class

SPCmdlet Members

WriteError Overload

Microsoft.SharePoint.PowerShell Namespace