Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.
Examples of Cmdlet Code
This section contains examples of cmdlet code that you can use to start writing your own cmdlets.
|If you want step-by-step instructions for writing cmdlets, see Tutorials for Writing Cmdlets.|
In This Section
- How to Write a Simple Cmdlet
- This example shows the basic structure of cmdlet code.
- How to Declare Cmdlet Parameters
- This example shows how to declare the different types of parameters.
- How to Declare Parameter Sets
- This example shows how to declare sets of parameters that can change the action a cmdlet performs.
- How to Validate Parameter Input
- These examples show how to validate parameter input.
- How to Declare Dynamic Parameters
- This example shows how to declare a parameter that is added at runtime.
- How to Invoke Scripts Within a Cmdlet
- This example shows how to invoke a script that is supplied to a cmdlet.
- How to Override Input Processing Methods
- These examples show the basic structure used to override the BeginProcessing, ProcessRecord, and EndProcessing methods.
- How to Request Confirmations
- This example shows how the ShouldProcess and ShouldContinue methods should be called from within a cmdlet.
- How to Support Transactions
- This example shows how to indicate that the cmdlet supports transactions and how to implement the action that is taken when the cmdlet is used within a transaction.
- How to Support Jobs
- This example shows how to support jobs when you write cmdlets.
- How to Invoke a Cmdlet from Within a Cmdlet
- This example shows how to invoke a cmdlet from within another cmdlet, which allows you to add the functionality of the invoked cmdlet to the cmdlet you are developing.
Other ResourcesWriting a Windows PowerShell Cmdlet