PowerShell result to HTML report format











up vote
1
down vote

favorite












Currently I'm stuck in outputing the below PowerShell result into a HTML report. I have the below PowerShell script to query through to get replication result.



Get-3parRCopy > showrcopy.txt
$a = (Get-Content showrcopy.txt -Raw) -split "(?sm)^Names+Target.*?`r?`n" |
Select-Object -Skip 1 |
ForEach-Object { ($_ -split 's')[0] }

foreach ($b in $a) { Get-3parRCopy -groups $b }


The result from the above is as below




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


How can I output the above result into HTML with the format like below.



desired html output










share|improve this question
























  • foreach ($b in $a) { Get-3parRCopy -groups $b } | Convertto-Html , does this work for you?
    – Moerwald
    Nov 12 at 6:52












  • directly convertto-html does not work for me..
    – Faizal Izham
    Nov 12 at 7:22










  • Do you actually have the desired html output in text format? (And not only an image) Or do you want us to write the html code too?
    – marsze
    Nov 12 at 8:46










  • For one thing: don't write cmdlet output to a file then read the file back into PowerShell. That will turn your data into a flat string even if it was a list of structured objects before. What kind of output does your cmdlet produce (Get-3parRCopy | Get-Member)? For using ConvertTo-Html you need a list of objects. If your output is flat text anyway you'll have to parse it into objects first.
    – Ansgar Wiechers
    Nov 12 at 9:26










  • Hi marsze, i have the resulted output as per above but not in html format. would appreciate if you can help to get code to just convert the data to html format in the desired output just a plain table format that would be suffice. i can try to figure out to get the color coding later on.
    – Faizal Izham
    Nov 12 at 10:08















up vote
1
down vote

favorite












Currently I'm stuck in outputing the below PowerShell result into a HTML report. I have the below PowerShell script to query through to get replication result.



Get-3parRCopy > showrcopy.txt
$a = (Get-Content showrcopy.txt -Raw) -split "(?sm)^Names+Target.*?`r?`n" |
Select-Object -Skip 1 |
ForEach-Object { ($_ -split 's')[0] }

foreach ($b in $a) { Get-3parRCopy -groups $b }


The result from the above is as below




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


How can I output the above result into HTML with the format like below.



desired html output










share|improve this question
























  • foreach ($b in $a) { Get-3parRCopy -groups $b } | Convertto-Html , does this work for you?
    – Moerwald
    Nov 12 at 6:52












  • directly convertto-html does not work for me..
    – Faizal Izham
    Nov 12 at 7:22










  • Do you actually have the desired html output in text format? (And not only an image) Or do you want us to write the html code too?
    – marsze
    Nov 12 at 8:46










  • For one thing: don't write cmdlet output to a file then read the file back into PowerShell. That will turn your data into a flat string even if it was a list of structured objects before. What kind of output does your cmdlet produce (Get-3parRCopy | Get-Member)? For using ConvertTo-Html you need a list of objects. If your output is flat text anyway you'll have to parse it into objects first.
    – Ansgar Wiechers
    Nov 12 at 9:26










  • Hi marsze, i have the resulted output as per above but not in html format. would appreciate if you can help to get code to just convert the data to html format in the desired output just a plain table format that would be suffice. i can try to figure out to get the color coding later on.
    – Faizal Izham
    Nov 12 at 10:08













up vote
1
down vote

favorite









up vote
1
down vote

favorite











Currently I'm stuck in outputing the below PowerShell result into a HTML report. I have the below PowerShell script to query through to get replication result.



Get-3parRCopy > showrcopy.txt
$a = (Get-Content showrcopy.txt -Raw) -split "(?sm)^Names+Target.*?`r?`n" |
Select-Object -Skip 1 |
ForEach-Object { ($_ -split 's')[0] }

foreach ($b in $a) { Get-3parRCopy -groups $b }


The result from the above is as below




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


How can I output the above result into HTML with the format like below.



desired html output










share|improve this question















Currently I'm stuck in outputing the below PowerShell result into a HTML report. I have the below PowerShell script to query through to get replication result.



Get-3parRCopy > showrcopy.txt
$a = (Get-Content showrcopy.txt -Raw) -split "(?sm)^Names+Target.*?`r?`n" |
Select-Object -Skip 1 |
ForEach-Object { ($_ -split 's')[0] }

foreach ($b in $a) { Get-3parRCopy -groups $b }


The result from the above is as below




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


How can I output the above result into HTML with the format like below.



desired html output







powershell






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 9:19









Ansgar Wiechers

139k12120183




139k12120183










asked Nov 12 at 6:14









Faizal Izham

203




203












  • foreach ($b in $a) { Get-3parRCopy -groups $b } | Convertto-Html , does this work for you?
    – Moerwald
    Nov 12 at 6:52












  • directly convertto-html does not work for me..
    – Faizal Izham
    Nov 12 at 7:22










  • Do you actually have the desired html output in text format? (And not only an image) Or do you want us to write the html code too?
    – marsze
    Nov 12 at 8:46










  • For one thing: don't write cmdlet output to a file then read the file back into PowerShell. That will turn your data into a flat string even if it was a list of structured objects before. What kind of output does your cmdlet produce (Get-3parRCopy | Get-Member)? For using ConvertTo-Html you need a list of objects. If your output is flat text anyway you'll have to parse it into objects first.
    – Ansgar Wiechers
    Nov 12 at 9:26










  • Hi marsze, i have the resulted output as per above but not in html format. would appreciate if you can help to get code to just convert the data to html format in the desired output just a plain table format that would be suffice. i can try to figure out to get the color coding later on.
    – Faizal Izham
    Nov 12 at 10:08


















  • foreach ($b in $a) { Get-3parRCopy -groups $b } | Convertto-Html , does this work for you?
    – Moerwald
    Nov 12 at 6:52












  • directly convertto-html does not work for me..
    – Faizal Izham
    Nov 12 at 7:22










  • Do you actually have the desired html output in text format? (And not only an image) Or do you want us to write the html code too?
    – marsze
    Nov 12 at 8:46










  • For one thing: don't write cmdlet output to a file then read the file back into PowerShell. That will turn your data into a flat string even if it was a list of structured objects before. What kind of output does your cmdlet produce (Get-3parRCopy | Get-Member)? For using ConvertTo-Html you need a list of objects. If your output is flat text anyway you'll have to parse it into objects first.
    – Ansgar Wiechers
    Nov 12 at 9:26










  • Hi marsze, i have the resulted output as per above but not in html format. would appreciate if you can help to get code to just convert the data to html format in the desired output just a plain table format that would be suffice. i can try to figure out to get the color coding later on.
    – Faizal Izham
    Nov 12 at 10:08
















foreach ($b in $a) { Get-3parRCopy -groups $b } | Convertto-Html , does this work for you?
– Moerwald
Nov 12 at 6:52






foreach ($b in $a) { Get-3parRCopy -groups $b } | Convertto-Html , does this work for you?
– Moerwald
Nov 12 at 6:52














directly convertto-html does not work for me..
– Faizal Izham
Nov 12 at 7:22




directly convertto-html does not work for me..
– Faizal Izham
Nov 12 at 7:22












Do you actually have the desired html output in text format? (And not only an image) Or do you want us to write the html code too?
– marsze
Nov 12 at 8:46




Do you actually have the desired html output in text format? (And not only an image) Or do you want us to write the html code too?
– marsze
Nov 12 at 8:46












For one thing: don't write cmdlet output to a file then read the file back into PowerShell. That will turn your data into a flat string even if it was a list of structured objects before. What kind of output does your cmdlet produce (Get-3parRCopy | Get-Member)? For using ConvertTo-Html you need a list of objects. If your output is flat text anyway you'll have to parse it into objects first.
– Ansgar Wiechers
Nov 12 at 9:26




For one thing: don't write cmdlet output to a file then read the file back into PowerShell. That will turn your data into a flat string even if it was a list of structured objects before. What kind of output does your cmdlet produce (Get-3parRCopy | Get-Member)? For using ConvertTo-Html you need a list of objects. If your output is flat text anyway you'll have to parse it into objects first.
– Ansgar Wiechers
Nov 12 at 9:26












Hi marsze, i have the resulted output as per above but not in html format. would appreciate if you can help to get code to just convert the data to html format in the desired output just a plain table format that would be suffice. i can try to figure out to get the color coding later on.
– Faizal Izham
Nov 12 at 10:08




Hi marsze, i have the resulted output as per above but not in html format. would appreciate if you can help to get code to just convert the data to html format in the desired output just a plain table format that would be suffice. i can try to figure out to get the color coding later on.
– Faizal Izham
Nov 12 at 10:08












1 Answer
1






active

oldest

votes

















up vote
0
down vote













ConvertTo-Html cmdlet has a Head parameter that allows you to specify the HTML code that will go into the HEAD element. So you can create CSS style tags to obtain the desired format.



A good article can be found here: https://4sysops.com/archives/building-html-reports-in-powershell-with-convertto-html/






share|improve this answer





















  • sorry i have tried to do exactly what was written in the tutorial before.. but the output is not as expected.. but with get-psdrive it produce the same output as per the tutorial.
    – Faizal Izham
    Nov 12 at 10:13











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53256756%2fpowershell-result-to-html-report-format%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













ConvertTo-Html cmdlet has a Head parameter that allows you to specify the HTML code that will go into the HEAD element. So you can create CSS style tags to obtain the desired format.



A good article can be found here: https://4sysops.com/archives/building-html-reports-in-powershell-with-convertto-html/






share|improve this answer





















  • sorry i have tried to do exactly what was written in the tutorial before.. but the output is not as expected.. but with get-psdrive it produce the same output as per the tutorial.
    – Faizal Izham
    Nov 12 at 10:13















up vote
0
down vote













ConvertTo-Html cmdlet has a Head parameter that allows you to specify the HTML code that will go into the HEAD element. So you can create CSS style tags to obtain the desired format.



A good article can be found here: https://4sysops.com/archives/building-html-reports-in-powershell-with-convertto-html/






share|improve this answer





















  • sorry i have tried to do exactly what was written in the tutorial before.. but the output is not as expected.. but with get-psdrive it produce the same output as per the tutorial.
    – Faizal Izham
    Nov 12 at 10:13













up vote
0
down vote










up vote
0
down vote









ConvertTo-Html cmdlet has a Head parameter that allows you to specify the HTML code that will go into the HEAD element. So you can create CSS style tags to obtain the desired format.



A good article can be found here: https://4sysops.com/archives/building-html-reports-in-powershell-with-convertto-html/






share|improve this answer












ConvertTo-Html cmdlet has a Head parameter that allows you to specify the HTML code that will go into the HEAD element. So you can create CSS style tags to obtain the desired format.



A good article can be found here: https://4sysops.com/archives/building-html-reports-in-powershell-with-convertto-html/







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 at 9:00









reverpie

18616




18616












  • sorry i have tried to do exactly what was written in the tutorial before.. but the output is not as expected.. but with get-psdrive it produce the same output as per the tutorial.
    – Faizal Izham
    Nov 12 at 10:13


















  • sorry i have tried to do exactly what was written in the tutorial before.. but the output is not as expected.. but with get-psdrive it produce the same output as per the tutorial.
    – Faizal Izham
    Nov 12 at 10:13
















sorry i have tried to do exactly what was written in the tutorial before.. but the output is not as expected.. but with get-psdrive it produce the same output as per the tutorial.
– Faizal Izham
Nov 12 at 10:13




sorry i have tried to do exactly what was written in the tutorial before.. but the output is not as expected.. but with get-psdrive it produce the same output as per the tutorial.
– Faizal Izham
Nov 12 at 10:13


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53256756%2fpowershell-result-to-html-report-format%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)