Skip to content

GPtrustee object not returning currectly when run through SDK  #15269

@erenturkm

Description

@erenturkm

I have been using Powershell SDK to run a script that gets Group Policy Permissions on a GPO. When I run the script below over Remote Powershell on a Windows 2016 Host, it returns GPPermission Objects and when I walk through it the Trustee property is correctly returned as GPTrustee object. When I run this script from Powershell SDK 7.1.3, the trustee property returns a string for type of the object instead of the value. Note that rest of the permission object is populated fine.

Steps to reproduce

$Dic=@{}
$List= New-Object Collections.Generic.List[string]
$GPOs=Get-GPO -All
foreach($G in $GPOs) 
{
	$Perms=Get-GPPermission -Name $G.DisplayName -all -TargetType Group -ErrorAction SilentlyContinue
	$Dic[$G.DisplayName]=$Perms
}
$Dic

Expected behavior

$Dic[<Any GPO>][0].Trustee.getType() returns GPTrustee object.

Actual behavior

Visiual Studio c# code

Perm.Properties.Match("Trustee")[0].Value returns "Microsoft.GroupPolicy.GPTrustee"

Environment data


Remote Powershell output
Name                           Value
----                           -----
PSVersion                      5.1.17763.592
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.592
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

SDK Version.
PSVersion=7.1.3
PSEdition=Core
WSManStackVersion=3.0
PSRemotingProtocolVersion=2.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-AnsweredThe question is answered.WG-RemotingPSRP issues with any transport layer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions