Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 1.29 KB

File metadata and controls

31 lines (22 loc) · 1.29 KB
description Displaying Error Information
ms.date 09/13/2016
title Displaying Error Information

Displaying Error Information

This topic discusses the ways in which users can display error information.

When your cmdlet encounters an error, the presentation of the error information will, by default, resemble the following error output.

$ Stop-Service lanmanworkstation
You do not have sufficient permissions to stop the service Workstation.

However, users can view errors by category by setting the $ErrorView variable to "CategoryView". Category view displays specific information from the error record rather than a free-text description of the error. This view can be useful if you have a long list of errors to scan. In category view, the previous error message is displayed as follows.

$ $ErrorView = "CategoryView"
$ Stop-Service lanmanworkstation
CloseError: (System.ServiceProcess.ServiceController:ServiceController) [Stop-Service], ServiceCommandException

For more information about error categories, see Windows PowerShell Error Records.

See Also

Windows PowerShell Error Records

Writing a Windows PowerShell Cmdlet