GetProc04 (C#) Sample Code


The following code shows the implementation of a Get-Process cmdlet that reports nonterminating errors. This implementation calls the WriteError method to report nonterminating errors.


You can download the C# source file (getprov04.cs) for this Get-Proc cmdlet using the Microsoft Windows Software Development Kit for Windows Vista and .NET Framework 3.0 Runtime Components. For download instructions, see How to Install Windows PowerShell and Download the Windows PowerShell SDK [delete].

The downloaded source files are available in the <PowerShell Samples> directory.