Reflect Powershell CmdLet using Jetbrains DotPeek. Credit to Nivok Ink for his version using Redgate Reflector.
Last active
January 7, 2025 18:29
-
-
Save dennisroche/013c5a56d9a7f16851cb to your computer and use it in GitHub Desktop.
Reflect Powershell CmdLet using Jetbrains DotPeek
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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