Manipulating Perfmon data for easy combining and relogging for multiple device comparison.

Jose P 21 Reputation points
2022-08-03T14:45:01.507+00:00

What I'm trying to do:
Perfmon is collecting data from multiple servers. I pulled the .blg files, and then combine them into one file for performance review of multiple servers.
I combine the .blg files using the following script:

Relog *servernames*.blg -f bon -o combined.blg  

Then I change them to .csv using:

Relog combined.blg -f csv -o combined.csv  

My problem is that perfmon is collecting at different times: For example, server1, the time 12:05:02 while server 2 has time of 12:05:05. This causes two instances to appear when combining, rather than just one for 12:05.
How can I manipulate the data so that both servers are collecting at the same time (i.e. 12:05:00) and still be able to combine the data for comparison?

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,341 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,418 questions
Sysinternals
Sysinternals
Advanced system utilities to manage, troubleshoot, and diagnose Windows and Linux systems and applications.
1,107 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 45,261 Reputation points
    2022-08-05T22:50:14.89+00:00

    Try this:

    $time = ""  
    $oneshot = $true  
    $rec = [ordered]@{  
        Date = ""  
        Server1 = "."  
        Server2 = "."  
    }  
      
    Import-CSV C:\junk\Combine.csv -delimiter "|"  |  
        ForEach-Object{  
            $d = get-date $_."Date "                    # Note that all property names contain a trailing space!  
            $d = $d.AddSeconds(-($d.Second))            # convert textual time into a DateTime object and set seconds to zero  
            if ($oneshot){  
                $oneshot = $false  
                $time = $d  
            }  
            if ($d -ne $time){                          # time isn't the same, dump a new record  
                $rec.Date = $time  
                [PSCustomObject]$rec  
                $time = $d  
                $rec.Server1 = "."  
                $rec.Server2 = "."  
            }  
            if (($_."Server 1 ").Trim() -ne "."){  
                $rec.Server1 = ($_."Server 1 ").Trim()  
            }  
            if (($_."Server 2 ").Trim() -ne "."){  
                $rec.Server2 = ($_."Server 2 ").Trim()  
            }  
        } | Export-Csv c:\Junk\Combine_NoSec.csv -NoTypeInformation  
    # Dump the pending record  
    [PSCustomObject]$rec | Export-Csv c:\Junk\Combine_NoSec.csv -Append -NoTypeInformation  
    
    0 comments No comments