The part of this that works to gather the data is:
$Connection = Get-DfsrConnection $Connection | ForEach-Object { $Source = $_.SourceComputerName $Group = $_.GroupName $Destination = $_.DestinationComputerName $stats = Get-DfsrBacklog -GroupName $Group -SourceComputerName $Source -DestinationComputerName $Destination -Verbose 4>&1 @{Group=$Group BackLog_Count=$stats.Message.Split(':')[2] SourceComputer=$Source DestinationComputer=$Destination } }
I am trying to create a table with the data and I am failing on something:
$Connection = Get-DfsrConnection $tabName = "BackLog_Count_Table" $table = New-Object system.Data.DataTable "$tabName" $col1 = New-Object system.Data.DataColumn Group,([string]) $col2 = New-Object system.Data.DataColumn BackLog_Count,([string]) $col3 = New-Object system.Data.DataColumn SourceComputer,([string]) $col4 = New-Object system.Data.DataColumn DestinationComputer,([string]) $Connection | ForEach-Object { $Source = $_.SourceComputerName $Group = $_.GroupName $Destination = $_.DestinationComputerName $stats = Get-DfsrBacklog -GroupName $Group -SourceComputerName $Source -DestinationComputerName $Destination -Verbose 4>&1 if ($stats.Message.Split(':')[2] -gt 1) { $row = $table.NewRow() $row.Group=$Group $row.BackLog_Count=$stats.Message.Split(':')[2] $row.SourceComputer=$Source $row.DestinationComputer=$Destination } } $table | FT -AutoSize
This is my first try at creating a table. Once I get it in table format, then I will add all the functions to create an email, etc. for the purposes of alerting.
Thank you for any information you can provide.