代码之家  ›  专栏  ›  技术社区  ›  ChopperCharles

如何在给定模块中找到cmdlet(从文件加载)

  •  0
  • ChopperCharles  · 技术社区  · 10 年前

    我有一个充满PowerShell cmdlet的C#DLL,我想知道如何从PowerShell提示符中检索cmdlet列表。我试过:

    Import-Module .\psconfig.dll
    Get-Command -Name psconfig
    

    但这行不通。(导入有效,但不能 Get-Command )

    这样做的正确方法是什么,以便我只获得DLL中包含的cmdlet列表?

    1 回复  |  直到 10 年前
        1
  •  3
  •   Ansgar Wiechers    10 年前

    Get-Command -Name psconfig 正在查找名为的cmdlet psconfig 。获取从导入的cmdlet列表 psconfig.dll 您需要列出该模块的导入cmdlet:

    Get-Command -ListImported -Module psconfig
    

    或者只是

    Get-Command -Module psconfig
    
    推荐文章