Skip to content

Instantly share code, notes, and snippets.

@dennisroche
Last active February 22, 2024 19:59
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dennisroche/013c5a56d9a7f16851cb to your computer and use it in GitHub Desktop.
Save dennisroche/013c5a56d9a7f16851cb to your computer and use it in GitHub Desktop.
Reflect Powershell CmdLet using Jetbrains DotPeek

Reflect Powershell CmdLet using Jetbrains DotPeek. Credit to Nivok Ink for his version using Redgate Reflector.

function Peek-Cmdlet {
param(
[Management.Automation.CommandInfo]$command
)
if ($input) {
trap { $_; break }
$command = $input | select -first 1
}
# resolve to command if this is an alias
while ($command.CommandType -eq "Alias") {
$command = Get-Command ($command.definition)
}
$name = $command.ImplementingType
$dll = $command.DLL
$inspector = "C:\Program Files (x86)\JetBrains\dotPeek\v1.1\Bin\dotPeek32.exe"
& $inspector /select=$dll!$name
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment