I am writint va code, which will fetch all the ids from GET-GOP, to feed it to GetGPPermission to extract all details. Though I am able to get all the Ids from GPO, not able to feed them to GPPermission. Below is my code
$GPOIDs = GET-GPO -ALL | SELECT id
$results = foreach ($GPOID in $GPOIDS) {Get-GPPermission -GUID $GPOID -ALL}
GET-GPO-ALL gets all ids, however the output looks like the below
@{Id=31b2f340-016d-11d2-945f-00c04fb984f9} @{Id=6ac1786c-016f-11d2-945f-00c04fb984f9} @{Id=eb996917-09f6-46f0-9f5c-0c6d40f10e1f} @{Id=b9e5f37f-48a5-43f9-9e66-eb9014118d6f} @{Id=21313288-2189-4e4a-a1…
when each of the above is passed to Get-GPPermission, I get the below message in each input
Get-GPPermission : Cannot bind parameter ‘Guid’. Cannot convert the “@{Id=31b2f340-016d-11d2-945f-00c04fb984f9}” value
of type “Selected.Microsoft.GroupPolicy.Gpo” to type “System.Guid”.
I think Get-GPPermission is not able find the details since the @{id= and the other } at the end of the string also provided as GUID.
Can any one help, what mistake I am making and how to avoid it.
thanks