首页 > 解决方案 > Powershell Get-TransportRule 读取传输规则属性的完整数据

问题描述

Get-TransportRule "Gmail Block" | Select-Object "ExceptIfFrom" | Format-List 

返回结果

ExceptIfFrom : {terer.nolt@gmail.com, calendar-notification@google.com, brianqfaanur@gmail.com, cced1rley657@gmail.com...}

我将如何请求整个列表?

标签: powershelloffice365exchange-server

解决方案


更新$formatenumerationlimit为等于或大于您的集合大小的值:

# -1 is unlimited
$formatenumerationlimit = -1

当对象的属性值是一个集合并且您正在使用显示属性/值对的视图时,$formatenumerationlimit自动变量会确定集合中的多少项在被截断之前是可见的。默认值为4

您可以使用简单的对象轻松复制这种情况:

$obj = [pscustomobject]@{property = 1,2,3,4,5,6,7,8,9}
$obj

输出:

property
--------
{1, 2, 3, 4...}

现在更新$formatenumerationlimit

$formatenumerationlimit = 9
$obj
$formatenumerationlimit = -1
$obj

输出:

property
--------
{1, 2, 3, 4, 5, 6, 7, 8, 9}

property
--------
{1, 2, 3, 4, 5, 6, 7, 8, 9}

或者,仅检索属性的值可能会显示所有列表项,并且不受$formatenumerationlimit.

$obj.property
$obj | Select-Object -ExpandProperty property

输出:

1
2
3
4
5
6
7
8
9

1
2
3
4
5
6
7
8
9

推荐阅读