Reflection with Powershell


I have a set of .NET Assemblies (all under the same directory) and some of those contain classes which implement an abstract class. I would like a Powershell script to find all the classes which implement my abstract class, and execute a method on each of them.

Does anybody have an idea on how to do this?



Here’s a little function you might want to try.. (I haven’t tested it yet, as I don’t have any criteria to test this with easily..)

It can be used by supplying the paths (one or more full or relative paths separated by commas) on the command line like this

or from the pipeline

or with fileinfo objects from Get-Childitem (dir)

Tweak as needed..


Reflection with Powershell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply