How to Invoke Scripts Within a Cmdlet
This example shows how to invoke a script that is supplied to a cmdlet. The script is executed by the cmdlet, and its results are returned to the cmdlet as a collection of PSObject objects.
To invoke a script block
The command verifies that a script block was supplied to the cmdlet. If a script block was supplied, the command invokes the script block with its required parameters.
Then, the script iterates through the returned collection of PSObject objects and perform the necessary operations.
Other ResourcesWriting a Windows PowerShell Cmdlet