Pipeline question Get-Gpo | Get-GPPermissions

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Geraldo Quezada Geraldo Quezada 4 months, 1 week ago.

  • Author
    Posts
  • #48684
    Profile photo of Geraldo Quezada
    Geraldo Quezada
    Participant

    I had a question regarding as to how Get-GPO is gluing together the objects when they are pipelined to Get-GPPermissions.

    Get-GPO is producing Microsoft.GroupPolicy.GPO objects.
    Get-GPPermissions is expecting object of type Microsoft.GroupPolicy.GPPermission and do not accept pipeline input ByValue based on the help information. So I would think that is connecting ByPropertyName but there are no property name matching parameters for Get-GPPermissions.

    Any clarification will be greatly appreciated.

    Get-GPO Property Names:
    Computer
    CreationTime
    Description
    DisplayName
    GpoStatus
    Id
    ModificationTime
    Owner
    Path
    User
    WmiFilter

    Get-GPPermissions properties accepting pipeline input from help system ByPropertyName
    Domain
    Guid
    Name (position 1) Positional parameter

  • #48691
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    DisplayName is an alias for Name in the Get-GPPermission command, so binding by property name can still work. Any time you're curious about what PowerShell's doing with parameter binding, you can get all the gritty details with Trace-Command:

    $policies = Get-GPO
    
    Trace-Command -Name ParameterBinding -PSHost -Expression { $policies | Get-GPPermissions }
    
  • #48694
    Profile photo of Geraldo Quezada
    Geraldo Quezada
    Participant

    Thank you Dave for the information.

You must be logged in to reply to this topic.