Execute .NET Compiled code from PowerShell

I was troubleshooting some third party software the other day, it was some .NET code that was written by another vendor. Their logging scheme was lacking and the error on the browser side was less than helpful. I was mulling over the problem and the thought occurred to me, can’t I just load the DLL in to PowerShell and start executing methods until I find the problem?

After a little Binging sure enough and this is how you do it.

Start PowerShell with elevated permissions.

Load DLL into PowerShell session

[Reflection.Assembly]::LoadFile("c:\temp\the.dll")

Execute Methods

[the.Methods]::Sum(10, 2)

About the author