Author Posts

July 29, 2016 at 2:16 pm

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

July 29, 2016 at 2:28 pm

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 }

July 29, 2016 at 2:55 pm

Thank you Dave for the information.