【问题标题】:How do I combine multiple tables into 1 table in powershell?如何在powershell中将多个表合并为一个表?
【发布时间】:2012-02-03 08:35:14
【问题描述】:

在 powershell 中,我可以使用 Format-Table 命令对结果中的所有内容进行排序;但是我有相同的脚本需要从四个服务器返回数据。一旦我可以正确格式化表格,我将构建一个 HTML 报告并通过电子邮件发送它,但我不想要 4 个表格。我希望将所有表合并为一个。这特别与 Exchange 命令行管理程序和复制健康检查有关。

例如Get-StorageGroupCopyStatus命令返回信息如下:

Identity    SummaryCopyStatus  CopyQueueLength  ReplayQueueLength
--------    -----------------  ---------------  -----------------
Server\Db   Healthy                0               0
Server\Db   Healthy                0               0
Server\Db   Healthy                0               0
Server\Db   Healthy                0               0
Server\Db   Healthy                0               0
Server\Db   Healthy                0               0
Server\Db   Healthy                0               0
Server\Db   Healthy                0               0

我想将 4 台服务器的输出合并到一张大表中。在 powershell 中执行此操作的最佳方法是什么?

【问题讨论】:

    标签: powershell windows-server-2008 exchange-server powershell-2.0 exchange-server-2007


    【解决方案1】:

    假设您可以从一个中心位置查询您的服务器,只需在脚本块中执行您的命令并将结果通过管道传输到 convertto-html cmdlet。

    &{Get-StorageGroupCopyStatus SERVERA;Get-StorageGroupCopyStatus SERVERB} | convertto-html
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-02
      • 2011-11-18
      • 2021-11-24
      • 2020-07-19
      • 2010-10-06
      • 2012-07-19
      • 2021-12-12
      相关资源
      最近更新 更多