Powershell: list members of a .net component -


I am trying to create a script which will provide a list of DLL's methods from a pure component.

Even what I have done:

  absolute ([string] $ path) if ($ path. Stars ("[")) {$ Asm = [reflection. Assembly] :: LoadWidthPertialName ($ path) $ asm.GetTypes () | Choose names, namespaces. Sort namespace | Ft -groupby namespace} and {$ asm = [Reflection.Assembly] :: loadfile ($ path) $ asm.GetTypes () | Choose names, namespaces. Sort namespace | Ft-groupby namespace}   

So basically the second part of the script (when rendering the path of a dll) is working perfectly fine;

Running. GetDllMethods .ps1-path "C: \ program files (x86) \ WinSCP \ WinSCPnet.dll" will provide me all members of WinSCP dll.

What I want to achieve with the first part is to get the script by giving the name of the .NET component to get the same result:

. GetDllMethods.ps1-path "[System.IO.StreamWriter]"

To get all the members of the serial component.

But I'm getting an exception here .. any hint?

While other answers are technically correct, they do not answer your question that your script Why is not the first part working?

I think this is the reason for two reasons:

  1. If the assembly is already full, then it will probably result in a zero-value response. >
  2. The syntax for the LoadWithPartialName method does not use square brackets, so you need to filter them out of the string, or do not supply them in the first place

    Can the Assembly be already filled with the following? [Reflection.Assembly] :: GetAssembly ('assembly name')

    Wrap it into a try to grab if the assembly load If not, then handle the error.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -