Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find PowerShell Static Classes and Methods?

How can I find what Static Classes and Methods there is available in PowerShell 2.0?

like image 389
jrara Avatar asked Apr 27 '26 10:04

jrara


1 Answers

You can use any .NET types and their static methods from PowerShell. To enumerate all that are currently loaded into your AppDomain, you can do:

 [AppDomain]::CurrentDomain.GetAssemblies() | foreach { $_.GetTypes() } | foreach { $_.GetMethods() } | where { $_.IsStatic } | select DeclaringType, Name | format-table

Remember, you are not limited to static methods, you can also instantiate the types using new-object and call instance methods. You can use get-member on an instance to get the methods on a type.

Also, if you want to list your available CmdLets, just invoke:

Get-Command
like image 123
driis Avatar answered Apr 29 '26 01:04

driis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!