mercredi 1 mai 2019

Someone help me with loading this dll with reflection and powershell?

I am trying to load a C# DLL into Powershell. I have searched and searched and tried a lot of different examples and I think I am just doing this wrong. I am trying to call a DLL, and have the DLL give me a string.

DLL

namespace Decrypt
{
    public class Class1
    {
        public void Decrypt(out string dsn)
        {
            //Console.Write("test");
            dsn = "test";
        }
    }
}


$assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom('c:\users\justin\desktop\decrypt.dll');
[Decrypt.Class1]::Decrypt.ToString();

MemberType          : Method
OverloadDefinitions : {string ToString()}
TypeNameOfValue     : System.Management.Automation.PSMethod
Value               : string ToString()
Name                : ToString
IsInstance          : True





Aucun commentaire:

Enregistrer un commentaire