You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PowerShell获取Get-TransportRule传输规则ExceptIfFrom完整列表方法

解决PowerShell查询Exchange传输规则ExceptIfFrom属性截断问题

问题原因

PowerShell默认全局配置$FormatEnumerationLimit值为4,所有集合/数组类型的属性最多仅展示前4个元素,超出部分自动用省略号截断。

解决方案

可根据使用场景选择以下任意一种方式获取完整列表:

  • 临时调整展示规则,直接输出完整列表
    先修改全局变量关闭截断限制,再执行原查询命令即可:
    # 配置枚举类型属性不限制展示长度
    $FormatEnumerationLimit = -1
    # 执行原查询命令
    Get-TransportRule "Gmail Block" | Select-Object "ExceptIfFrom" | Format-List
    
  • 直接提取属性值输出所有邮箱
    不需要依赖Format-*系列命令,直接展开属性即可拿到完整数组:
    (Get-TransportRule "Gmail Block").ExceptIfFrom
    
  • 自定义格式输出,每个邮箱单独占一行
    可以通过计算属性将数组转为换行分隔的字符串,输出可读性更强:
    Get-TransportRule "Gmail Block" | Select-Object @{
      Name = "完整例外发件人列表"
      Expression = { $_.ExceptIfFrom -join "`n" }
    } | Format-List
    

内容的提问来源于stack exchange,提问作者Crash893

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.04 03:27:01