Intellisense / get-member in Powershell

Tags: powershell

One of the neat tricks is write out what Methods, Properties get-member cmdlet.  Here are a couple of replies I recently from my question in the Powershell newsgroup.  

Example 1
-------------
It works well for static methods (note the parenthesis and square brackets
around the class name):

PS> get-member -in ([system.math]) -static


Example 2
-------------
You don't need to assign to a variable. You can pipe the new object into the get-member call:

new-object text.stringBuilder | get-member -memberType methods

If you don't want to create an instance at all, you can use reflection:

[text.stringBuilder].getMethods() | % { $_.name } | sort -unique

1 Comment

  • Aaron Lerch said

    If you're looking for intellisense within the powershell console window, check out MoW's PowerTab along with my Invoke-Intellisense cmdlet:

    http://blog.aaronlerch.com/2007/04/powertab-09-for-powershell-and-invoke.html

    Cheers!

Add a Comment