Pipeline question Get-Gpo | Get-GPPermissions

Welcome Forums General PowerShell Q&A Pipeline question Get-Gpo | Get-GPPermissions

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
2 years, 5 months ago.

  • Author
    Posts
  • #48684

    Participant
    Points: 0
    Rank: Member

    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

    Member
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    Thank you Dave for the information.

The topic ‘Pipeline question Get-Gpo | Get-GPPermissions’ is closed to new replies.