What is the difference between Add-PSSnapin and Import-Module in PowerShell?

import-module, powershell, pssnapin

Solution

PsSnapins are the old fashion way (existing inPowerShell V1) to add CmdLet or Providers (but still in use)

- They need to be registered (with installutil.exe tool)

- They are assemblies written in one of the .NET language

Modules are the new way (added in PowerShel V2) to add CmdLet or Providers

- They just have to be joinable on the file system (see $env:psmodulepath)

- They may be scripts written in PowerShell (for CmdLet only) or assemblies for CmdLet and Providers written with one of the .NET language

It exists a manifest form that allow to specify much information about the creator, but also the dependancies on PowerShell versions, Framework version or other modules or assemblies version.

I think that you can use module unless you have to support existing PowerShell V1 computers.

Problem

Possible Duplicate: What’s the difference between Add-PsSnapIn and Import-Module What is the difference between `Add-PSSnapin` and `Import-Module` in PowerShell? At the end, both seem like they provide the same result. Which one is the recommended approach?

Original source

Related problems