I am trying to create a script that will give me a list of the dll method from the .net component.
Here is what I have done so far:
Param([String]$path)
if($path.StartsWith("["))
{
$asm = [Reflection.Assembly]::LoadWithPartialName($path)
$asm.GetTypes() | select Name, Namespace | sort Namespace | ft -groupby Namespace
}
else
{
$asm = [Reflection.Assembly]::LoadFile($path)
$asm.GetTypes() | select Name, Namespace | sort Namespace | ft -groupby Namespace
}
So basically the second part of the script (when providing the path to the dll) works 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 specifying the name of the .net component, using something like:
. \ GetDllMethods.ps1 -path "[System.IO.StreamWriter]"
To get the entire member of the StreamWriter component.
But I get an empty exception here .. Any hint?