How to find out DLL path of a PowerShell cmdlet

2020-08-13 05:27发布

问题:

I am using some cmdlets imported from a module and would like to find out where the DLLs are physically located so that I can use dotPeek or Reflector on them. Is there a way to find out the DLL path somehow?

回答1:

try with

( get-command my-cmdlet ).dll


回答2:

The accepted answer will work for cmdlets but not native functions such as Add-BgpRouter or Add-PrinterDriver. To determine the file path of a function use

$Function = Get-Command Add-BgpRouter
(Get-Module $Function.ModuleName).Path


标签: powershell