Windows PowerShell 管理单元提供了一种机制,用于向 shell 注册 cmdlet 集和另一个 Windows PowerShell 提供程序,从而扩展 shell 的功能。 Windows PowerShell 管理单元可以注册单个程序集中的所有 cmdlet 和提供程序,也可以注册特定 cmdlet 和提供程序列表。
管理单元程序集应安装在受保护的目录中,就像它们与其他作系统一样。 否则,恶意用户可以将程序集替换为不安全的代码。
Windows PowerShell 管理单元类
所有 Windows PowerShell 管理单元类都派生自 System.Management.Automation.PSSnapIn 或 System.Management.Automation.CustomPSSnapIn 类。
例子
编写 Windows PowerShell 管理单元:此示例演示如何创建用于在程序集中注册所有 cmdlet 和提供程序的管理单元。
编写自定义 Windows PowerShell 管理单元:此示例演示如何创建自定义管理单元,该管理单元用于注册单个程序集中可能或可能不存在的特定 cmdlet 和提供程序集。
另请参阅
System.Management.Automation.PSSnapIn