concept PowerShell language in category powershell

This is an excerpt from Manning's book Windows PowerShell in Action, Third Edition.
We’ll begin our investigation with a detailed discussion of PowerShell scriptblocks, which are at the center of most of the metaprogramming techniques. This discussion takes up the first part of this chapter and lays the groundwork for the rest of what we’ll discuss. With that material as context, we’ll look at how and where scriptblocks are used in PowerShell. We’ll look at the role scriptblocks play in the creation of custom objects and types and how they can be used to extend the PowerShell language. We’ll cover techniques like proxy functions, dynamic modules, and custom objects—all of which are examples of applied metaprogramming. Then we’ll move on, and you’ll see how you can use similar techniques with static languages like C# from within your scripts. But first you need to understand scriptblocks themselves.
In the previous section, you learned how to add members to existing objects one at a time, but sometimes you’ll want to construct new types rather than extend the existing types. In this section, we’ll explain how to do that and also how to use scripting techniques to add the ability to create objects to the PowerShell language.