Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Formatting repadmin output

$
0
0

Hi all,

I'm trying to format output of repadmin /replsummary command within powershell.

In my script, very first thing, i execute repadmin /replsummary within powershell and format output a little bit as follow:

$myRepInfo = @(repadmin /replsum * /bysrc /bydest /sort:delta)
$msg = $myRepInfo | Where-Object { $_ } | ForEach-Object { $_ -replace $_,"$_`n" }
$last = $msg -replace "Beginning data collection for replication summary, this may take awhile:",""
$last >> C:\scripts\repsummary.log

But when i try to get-content of replsummary.txt, i can not sort output using columns since within repsummary.txt there is no chance to use delimeter or columns, it's really a bad designed output.

Here is the actual repadmin /replsummary output file:

What i want to achieve is to use repsummary txt output to create a table in powershell that includes Source,Destination and Error fields only. So that i will be able to create a html table and assign red color for each failed row.

Thanks in advance.


Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>