What's the difference between Add-PsSnapIn and Import-Module

前端 未结 5 1220
孤独总比滥情好
孤独总比滥情好 2020-12-24 06:11

Powershell has two means for importing additional cmdlets into a session, Add-PsSnapIn and Import-Module. The docs are not at all clear regarding when one would chose one ov

5条回答
  •  孤城傲影
    2020-12-24 06:17

    In v2, modules are the preferred way organize the cmdlets, providers, functions, aliases, and other commands that you create. You don't install a module. You simply import a module into the PowerShell session using Import-Module cmdlet.

    AFAIK, a PowerShell snapin is more of a v1 approach. There are still a few teams at MS creating snapins instead of modules. For example, SharePoint 2010 cmdlets. PowerShell snapins are binaries (.dll) that implement cmdlets and providers. You need to install a snapin and then add the cmdlets in the snapin to a PowerShell session using Add-PSSnapin cmdlet.

提交回复
热议问题