我有一个充满PowerShell cmdlet的C#DLL,我想知道如何从PowerShell提示符中检索cmdlet列表。我试过:
Import-Module .\psconfig.dll Get-Command -Name psconfig
但这行不通。(导入有效,但不能 Get-Command )
Get-Command
这样做的正确方法是什么,以便我只获得DLL中包含的cmdlet列表?
Get-Command -Name psconfig 正在查找名为的cmdlet psconfig 。获取从导入的cmdlet列表 psconfig.dll 您需要列出该模块的导入cmdlet:
Get-Command -Name psconfig
psconfig
psconfig.dll
Get-Command -ListImported -Module psconfig
或者只是
Get-Command -Module psconfig