← Docs home

Derive from the Cmdlet or PSCmdlet Classes

📐 Rule

A cmdlet must derive from either

- System.Management.Automation.Cmdlet or

- System.Management.Automation.PSCmdlet.

Every cmdlet class you implement must be public.

Cmdlet vs PSCmdlet.

Cmdlet

Does not depend on the PowerShell runtime. It can be called directly from any .NET language.

PSCmdlet

depends on the PowerShell runtime. It executes within a runspace.

Why.

The base class wires the type into PowerShell's command model. A non-public class is invisible to the runtime.