Powershell: list members of a .net component

Question:

I’m trying to build a script that will provide me the listing of the method of a dll from a .net component.

Here’s what I’ve done so far:

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

Running ‘.\GetDllMethods.ps1 -path “C:\Program Files (x86)\WinSCP\WinSCPnet.dll”‘ will provide me with all the members of the WinSCP dll.

What I want to achieve with the first part of the script is to get the same result by providing the name of the .net component using something like:

.\GetDllMethods.ps1 -path “[System.IO.StreamWriter]”

To get all the member of the StreamWriter component.

But I’m getting a null exception here.. Any hint ?

Answer:

you can use the powershell cmdlet get-member

we can see there is a GetMethods method, so try :

Source:

Powershell: list members of a .net component by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply