PowerTip: Find Syntax for PowerShell Method

PowerTip: Find Syntax for PowerShell Method

  • Comments 2
  • Likes

Summary: Use Windows PowerShell to find the syntax for a method.

Hey, Scripting Guy! Question I am trying to figure out how to use a .NET Framework method, but it is not working.
           How can I get a better idea of what to do?

Hey, Scripting Guy! Answer Call the method with no parenthesis or parameters, for example:

[DateTime]::DaysInMonth

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Another trick to the same "Method" is by using GET-MEMBER. Access the Method name from the Object through GET-MEMBER and pipe it to a Format-List (If you don't FORMAT-List you will only receive a quick summary of the Method's output)

    For Example

    GET-DATE | GET-Member addyears | FORMAT-LIST

    Sean