14

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?

Borek Bernard
  • 50,745
  • 59
  • 165
  • 240

2 Answers2

23

try with

( get-command my-cmdlet ).dll
Liam
  • 27,717
  • 28
  • 128
  • 190
CB.
  • 58,865
  • 9
  • 159
  • 159
  • This even works with native cmdlets - `( get-command Rename-Item ).dll`. Of course you still have to do some digging to find the actual provider (e.g. `FileSystemProvider` in the GAC's `System.Management.Automation.dll`). – Ohad Schneider Mar 27 '16 at 00:50
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
pirateofebay
  • 930
  • 1
  • 10
  • 25