Problem
You want to use PowerShell cmdlets and providers written by a third party.
Solution
In PowerShell, extensions that contain additional cmdlets and providers are called snapins. The author might distribute them with an automated installer but can also distribute them as a standalone PowerShell assembly. PowerShell identifies each snapin by the filename of its assembly and by the snapin name that its author provides.
To use a snapin:
- Obtain the snapin assembly.
- Copy it to a secure location on your computer. Since snapins are equivalent to executable programs, pick a location (such as the Program Files directory) that provides users read access but not write access.
- Register the snapin. From the directory that contains the snapin assembly, run InstallUtil SnapinFilename.dll. This command lets all users on the computer load and run commands defined by the snapin. You can find the InstallUtil utility in the .NET Framework’s installation directory—commonly C:\WINDOWS\ Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe.
- Add the snapin. At a PowerShell prompt (or in your profile file), run the command AddPsSnapin SnapinIdentifier. To see all available snapin identifiers, review the names listed in the output of the command:
GetPsSnapin Registered
5. Use the cmdlets and providers contained in that snapin.
To remove the snapin registration from your system, type InstallUtil /u SnapinFilename.dll. Once uninstalled, you may delete the files associated with the snapin.
Discussion
For interactive use (or in a profile), the AddPsSnapin cmdlet is the most common way to load an individual snapin.
One popular source of additional snapins is the PowerShell Community Extensions project, located at http://www.codeplex.com/PowerShellCX .