How to call my dll and use it in powershell script

I have my own dll , which is written in C #.
Now I want to call it from my powershell script.
I have done the following:

 [System.Reflection.Assembly]::LoadFile("E:\MyClass.dll") $MyCompObj = New-Object MyClass.Student 

But when I do this, it gives me an error
Constructor not found. Unable to find a suitable constructor for type MyClass.Student

Am I really wrong to do this?
Please help me fix this.

+7
source share
1 answer

There are constructors in your class (at least one). So create an object with good parameters

 $MyCompObj = New-Object MyClass.Student -argumentlist "arg1","Arg2" ... 
+8
source

Source: https://habr.com/ru/post/950701/


All Articles