当前,我只能将以下PowerShell结果输出到HTML报告中。我可以通过以下PowerShell脚本进行查询以获得复制结果。
Get-3parRCopy > showrcopy.txt
$a = (Get-Content showrcopy.txt -Raw) -split "(?sm)^Name\s+Target.*?`r?`n" |
Select-Object -Skip 1 |
ForEach-Object { ($_ -split '\s')[0] }
foreach ($b in $a) { Get-3parRCopy -groups $b }
以上结果如下
Remote Copy System Information Status: Started, Normal Group Information Name Target Status Role Mode Options GRP001Temp 3PARSYSTEM1 Started Primary Periodic Last-Sync 2018-11-04 00:08:09 MYT, Period 3h,over_per_alert LocalVV ID RemoteVV ID SyncStatus LastSyncTime LUN001-Temp 13304 LUN001-TempDR 16914 Synced 2018-11-04 00:08:10 MYT Remote Copy System Information Status: Started, Normal Group Information Name Target Status Role Mode Options GRP002-PHY01 3PARSYSTEM1 Started Primary Periodic Last-Sync 2018-11-04 01:17:54 MYT, Period 2h,auto_recover,over_per_alert LocalVV ID RemoteVV ID SyncStatus LastSyncTime LUN001-VVT2.12 120 LUN001-VVT2.12 210 Syncing (33%) 2018-11-03 23:51:04 MYT Remote Copy System Information Status: Started, Normal Group Information Name Target Status Role Mode Options GRP003-PHY02 3PARSYSTEM1 Started Primary Periodic Last-Sync 2018-11-04 01:27:12 MYT, Period 1h45m,auto_recover,over_per_alert LocalVV ID RemoteVV ID SyncStatus LastSyncTime LUN002-VVT2.14 130 LUN002-VVT2.14 207 Syncing (49%) 2018-11-03 23:59:27 MYT Remote Copy System Information Status: Started, Normal Group Information Name Target Status Role Mode Options GRP001-PRD-ORA 3PARSYSTEM1 Started Primary Periodic Last-Sync 2018-11-04 00:45:09 MYT, Period 2h,auto_recover,over_per_alert LocalVV ID RemoteVV ID SyncStatus LastSyncTime ORA-PROD-VG01.35 97 ORA-PROD-VG01.35 2451 Synced 2018-11-04 00:45:54 MYT ORA-PROD-VG02.36 98 ORA-PROD-VG02.36 2452 Synced 2018-11-04 00:46:10 MYT ORA-PROD-VG03.37 99 ORA-PROD-VG03.37 2453 Synced 2018-11-04 00:45:48 MYT ORA-PROD-VG04.38 100 ORA-PROD-VG04.38 2454 Synced 2018-11-04 00:45:12 MYT ORA-PROD-VG05.39 101 ORA-PROD-VG05.39 2455 Synced 2018-11-04 00:45:12 MYT Remote Copy System Information Status: Started, Normal Group Information Name Target Status Role Mode Options GRP001-PRD-SAP 3PARSYSTEM1 Started Primary Periodic Last-Sync 2018-11-04 01:24:25 MYT, Period 23m,auto_recover,over_per_alert LocalVV ID RemoteVV ID SyncStatus LastSyncTime SAP-PROD-APPS.4 80 SAP-PROD-APPS.4 1474 Synced 2018-11-04 01:24:28 MYT SAP-PROD-LOCK.19 95 SAP-PROD-LOCK.19 1490 Synced 2018-11-04 01:24:25 MYT SAP-PROD-SAPDT1.5 81 SAP-PROD-SAPDT1.5 1475 Synced 2018-11-04 01:25:16 MYT SAP-PROD-SAPDT2.6 82 SAP-PROD-SAPDT2.6 1476 Synced 2018-11-04 01:25:05 MYT SAP-PROD-SAPDT3.7 83 SAP-PROD-SAPDT3.7 1477 Synced 2018-11-04 01:25:07 MYT SAP-PROD-SAPDT4.8 84 SAP-PROD-SAPDT4.8 1478 Synced 2018-11-04 01:25:41 MYT SAP-PROD-SAPDT5.9 85 SAP-PROD-SAPDT5.9 1479 Synced 2018-11-04 01:25:35 MYT SAP-PROD-SAPDT6.10 86 SAP-PROD-SAPDT6.10 1480 Synced 2018-11-04 01:25:56 MYT Remote Copy System Information Status: Started, Normal Group Information Name Target Status Role Mode Options GRP002-PRD-SAP 3PARSYSTEM1 Started Primary Periodic Last-Sync 2018-11-04 01:24:55 MYT, Period 23m,over_per_alert LocalVV ID RemoteVV ID SyncStatus LastSyncTime SAP-PROD-VG01.10 15 SAP-PROD-VG01.10 29769 Synced 2018-11-04 01:28:44 MYT
如何将以上结果输出为HTML,格式如下。
答案 0 :(得分:0)
ConvertTo-Html cmdlet具有Head参数,该参数允许您指定将进入HEAD元素的HTML代码。因此,您可以创建CSS样式标签来获取所需的格式。
可以在这里找到好文章:https://4sysops.com/archives/building-html-reports-in-powershell-with-convertto-html/