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

Possible duplicate:
What is the difference between Add-PsSnapIn and Import-Module

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

In the end, both seem similar to the same result.

Which one is recommended?

+6
source share
1 answer

PsSnapins is an old way (existing inPowerShell V1) to add CmdLet or Providers (but still in use)

  • They need to register (using the installutil.exe tool)
  • These are assemblies written in the same .NET language.

Modules is a new way (added in PowerShel V2) to add CmdLet or providers

  • They just need to be attached to the file system (see $ env: psmodulepath)
  • They can be scripts written in PowerShell (CmdLet only) or assemblies for CmdLet and Providers written in the same .NET language.
  • There is an explicit form in it that allows you to specify a lot of information about the creator, as well as dependencies on PowerShell versions, Framework versions, or other versions of modules or assemblies.

    I think you can use the module if you do not need to support existing PowerShell V1 computers.

+9
source

Source: https://habr.com/ru/post/917500/


All Articles