如何从powershell系统数组对象中获取值

时间:2018-03-13 13:03:55

标签: powershell piping gpo

我有一个以下管道命令,应该打印GPO名称和与之关联的组,重复此操作,直到所有GPO和组都已打印。但输出不正确。该名称正确显示,但该组显示Microsoft.GroupPolicy.GPTrustee而不是组名称。 我该如何访问它才能获得价值?

这是我的管道命令:

Get-GPO -All | ForEach-Object {$gpo = $_.DisplayName; Write-Output $_;} | Get-GPPermission -All | 
    Where-Object {$_.Permission -eq "GpoApply"} | 
    Select-Object @{Name="GpoName"; Expression={$gpo}},@{Name="Group"; Expression={$_.trustee}}
编辑:问题已解决,但我仍然会复制“Microsoft.GroupPolicy”对象的输出,以澄清为什么我认为我可以使用$ _.trustee变量访问它。

看起来好像这样,$ _。trustee.name甚至没有让我想到。

Trustee     : Domain Computers
TrusteeType : Group
Permission  : GpoApply
Inherited   : False

0 个答案:

没有答案
相关问题