Powershell: list members of a .net component Powershell: list members of a .net component powershell powershell

Powershell: list members of a .net component


you can use the powershell cmdlet get-member

PS>[system.net.webclient]|get-member  -MemberType method                                                                                 TypeName : System.RuntimeType                                                                                Name                           MemberType Definition                                                            ----                           ---------- ----------                                                            AsType                         Method     type AsType()                                                         Clone                          Method     System.Object Clone(), System.Object ICloneable.Clone()               

...

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

[system.net.webclient].GetMethods()    


While the other answer is technically correct, they don't answer your question of why the first part of your script is not working.

I think it's a two part reason:

  1. If the assembly is already loaded, it will probably result in a null-value response
  2. The syntax for the LoadWithPartialName method don't use the square brackets, so you need to filter those out of the string, or don't supply them in the first place

You can check if the assembly is already loaded with the following:

[Reflection.Assembly]::GetAssembly('assemblyName')

Wrap it in a try-catch to handle the error if the assembly isn't loaded/found.