Editar

Compartilhar via


GetProc04 Code Samples

Here are the code samples for the GetProc04 sample cmdlet. This is the Get-Process cmdlet sample described in Adding Non-terminating Error Reporting to Your Cmdlet. This Get-Process cmdlet calls the System.Management.Automation.Cmdlet.WriteError method whenever an invalid operation exception is thrown while retrieving process information.

Note

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.

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

For complete sample code, see the following topics.

Language Topic
C# GetProc04 (C#) Sample Code
VB.NET GetProc04 (VB.NET) Sample Code

See Also