开发者

Enumerating cmdlets in an assembly using Powershell

I have an assembly that contains cmdlets. Can Powershell enumerate the cmdlets available in that assembly, without relying on reflection?

It seems that I should be able to do this with Get-Module, which returns a PSModuleInfo object that has an ExportedCmdlets property, but I can't seem to get results from it with my assembly, though I am able to import the same assembly with Import-Module and then call the cmd开发者_如何学JAVAlets in it.


Sure, you need to import the binary first:

Import-Module C:\path\to\assemblyName.dll

And then get the cmdlets using the Get-Command cmdlet with the -module parameter:

Get-Command -module assemblyName -type cmdlet
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜