How to Load .Net assemblies in powershell

In this article we will be seeing how to load the .Net assemblies in the powershell and how to access the methods.

I have created a class library as shown in the following.

assembly1.gif

My Solution looks like the following.

assembly2.gif

Build the solution.

Load the assembly:

Add-Type –Path "C:\LoadAssembly\LoadAssembly\bin\Debug\LoadAssembly.dll"

Access the method:

[LoadAssembly.Load]::method()

assembly3.gif