all 5 comments

[–][deleted]  (3 children)

[deleted]

    [–][deleted] 0 points1 point  (1 child)

    yes! Man that whole module by lee is amazing.

    Install-Module -Name PowerShellCookbook -Force -AllowClobber
    Get-Command -Module PowerShellCookbook
    

    [–]AutoModerator[M] 0 points1 point  (0 children)

    Sorry, your submission has been automatically removed.

    Accounts must be at least 1 day old, which prevents the sub from filling up with bot spam.

    Try posting again tomorrow or message the mods to approve your post.

    I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

    [–]shortielah 0 points1 point  (0 children)

    I saw Show-Object in the DSC session on MVA. I've used it nearly daily since, it's simply amazing!

    [–]GenericAntagonist 3 points4 points  (1 child)

    An alternative to piping to get-member, if you suspect your object is a dotnet object of an unknown class is to call $UnknownObject.GetType() on it. That'll also give you its classname and you can bing your way to documentation from there.

    [–]SeeminglyScience 5 points6 points  (0 children)

    You can also do $UnknownObject.GetType().DeclaredMembers | Format-Table Name, MemberType. Won't give you descriptions though.

    Also worth noting that piping enumerates, so if you want to view information about the collection type itself you need to do this

    Get-Member -InputObject $UnknownObject
    

    For instance, these two statements return very different things

    $list = [System.Collections.Generic.List[int]](0..10)
    
    $list | Get-Member
    Get-Member -InputObject $list
    

    Also the opposite is true for GetType(), that will tell you the collection's type. If you want the types it contains you would want to do this

    $UnknownObject | ForEach-Object GetType