Như bạn đã thấy trong chương 1, Windows PowerShell cung cấp một kiến trúc mở rộng cho phép chức năng mới được thêm vào vỏ. Chức năng này mới có thể được trong hình thức cmdlets, các nhà cung cấp, mở rộng loại, định dạng siêu dữ liệu, và do đó. | 1 Extending Windows PowerShell As you saw in Chapter 1 Windows PowerShell provides an extensible architecture that allows new functionality to be added to the shell. This new functionality can be in the form of cmdlets providers type extensions format metadata and so on. A Windows PowerShell snap-in is a .NET assembly that contains cmdlets providers and so on. Windows PowerShell comes with a set of basic snap-ins that offer all the basic cmdlets and providers built into the shell. You write a snap-in when you want your cmdlets or providers to be part of the default Windows PowerShell. When a snap-in is loaded in Windows PowerShell all cmdlets and providers in the snap-in are made available to the user. This model allows administrators to customize the shell by adding or removing snap-ins to achieve precise sets of providers and This chapter first introduces the two types of PowerShell snap-ins and describes when to use each one. It then shows you step by step how to author register and use both types of snap-ins. To make it more meaningful the code examples also show the minimum coding needed for authoring cmdlets. Note that all code examples in this chapter and the rest of the book are written in C . Types of PowerShell Snap-ins Any .NET assembly becomes a Windows PowerShell snap-in when the assembly implements a snap-in installer class. Windows PowerShell supports two distinct types of snap-in installer classes. The default recommended type is PSSnapin which registers all cmdlets and providers in a single contained assembly. The second type is CustomPSSnapin which enables developers to specify the list of cmdlets and providers from either a single or multiple assemblies. Through examples we first show you how to create and use a standard PowerShell snap-in and then we explain when you need to use a custom PowerShell snap-in and how to implement and use it. 1Note however that PowerShell built-in snap-ins such as cannot be .