Introducing snap-ins

Snap-ins are only available in Windows PowerShell; they are not present in PowerShell Core. A snap-in was the precursor to a module. It was the mechanism available to extend the set of commands in PowerShell 1.0. The cmdlet implementation inside a snap-in is similar to a binary module (written in a language such as C#). A snap-in contains a specialized class that holds the fields that were moved into the module manifest with PowerShell 2.0.

Snap-ins must be installed or registered before they can be used. This can be done using installutil, which is part of the .NET framework package. Many vendors (including Microsoft) took to releasing Microsoft Installer (MSI) packages to simplify the snap-in installation.

Modules have, for the most part, made snap-ins obsolete. Manifest modules, accompanied by a binary module, offer the same performance benefits, without the installation or registration overheads.

The list of snap-ins may be viewed using the following command:

Get-PSSnapIn -Registered

If the Registered parameter is excluded, Get-PSSnapIn will show the snap-ins that have been imported into the current PowerShell session.

Windows PowerShell and the Microsoft.PowerShell.Core snap-in

The core commands loaded for Windows PowerShell are a part of the snap-in written into the System.Management.Automation library. This snap-in does not appear in the list of registered snap-ins.

Registered snap-ins are read from HKLM:SoftwareMicrosoftPowerShell1PowerShellSnapIns.

If a computer does not have any registered snap-ins, the registry path may not exist. The snap-in list is generated by looping through all commands and reading the PSSnapIn property in a manner similar to the following command: (Get-Command).PSSnapIn.Name | Select-Object -Unique.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.80.213