- PowerShell for SQL Server Essentials
- Donabel Santos
- 209字
- 2021-07-23 20:32:25
Snap-ins and modules
You can extend PowerShell by loading snap-ins and modules. Snap-ins or PSSnapins
are dynamic linked library (DLLs) compiled from .NET code, which may contain additional cmdlets and PSProvider
. The PSSnapins
are old school—they are primarily how you extend version 1, but still supported in version 2, version 3, and version 4. Although considered old school, you can still create snap-ins. Refer to http://msdn.microsoft.com/en-us/library/ms714450(v=vs.85).aspx on how to do this.
The related snap-in cmdlets are as follows:
Add-PSSnapin
Get-PSSnapin
Remove-PSSnapin
Instead of snap-ins, the recommended way of extending the PowerShell functionality from version 2 onwards is using modules. Modules are similar to snap-ins when it comes to extending functionality, but unlike snap-ins, modules can also add functions. Modules also support autoloading, which means the module can be loaded as soon as one of its cmdlets/functions/PSDrive
are used.
Modules can be script-based or binary-based. A script module uses PowerShell code saved in a .psm1
file. A binary module is more similar to PSSnapin
, where it references a .NET DLL.
Modules are the new school way of extending PowerShell, from version 2 onwards. Related cmdlets are listed as follows:
Import-Module
Get-Module
Remove-Module
If you want to write PowerShell extensions, Microsoft recommends that you create modules instead of snap-ins.
- 大學(xué)計(jì)算機(jī)基礎(chǔ)(第三版)
- Kali Linux Web Penetration Testing Cookbook
- Spring Cloud Alibaba微服務(wù)架構(gòu)設(shè)計(jì)與開發(fā)實(shí)戰(zhàn)
- Delphi程序設(shè)計(jì)基礎(chǔ):教程、實(shí)驗(yàn)、習(xí)題
- Python從小白到大牛
- 人人都是網(wǎng)站分析師:從分析師的視角理解網(wǎng)站和解讀數(shù)據(jù)
- Elasticsearch Server(Third Edition)
- Learning AngularJS for .NET Developers
- LabVIEW虛擬儀器入門與測(cè)控應(yīng)用100例
- Learning Grunt
- 快樂編程:青少年思維訓(xùn)練
- jQuery Mobile Web Development Essentials(Second Edition)
- HTML5 Canvas核心技術(shù):圖形、動(dòng)畫與游戲開發(fā)
- Mastering ArcGIS Server Development with JavaScript
- Spring Boot 2+Thymeleaf企業(yè)應(yīng)用實(shí)戰(zhàn)