locked
Grouping results in Powershell RRS feed

  • Question

  • Hi

    I have a script which reads a list of servers and checks for some data on some PI logs

    But the problem is the results don't reflect what server its coming from- the first server in the list is being returned as a header

    Is there a way to include each server beside the results?

    Thanks

    $servers = get-content "P:\file"
    $results = @()
    foreach ($server in $servers)
    {
    
    Get-PIBackupSummary -Connection (Connect-PIDataArchive -PIDataArchiveMachineName $server)| 
    Select $server,BackupStart,StatusMessage,Type | 
    Foreach-Object {$_.BackupStart = [DateTime]$_.BackupStart; $_} | 
    Group-Object $server,Type | Foreach-Object {$_.Group | Sort-Object BackupStart | 
    Select-Object -Last 1}
    
    }

    Friday, November 16, 2018 4:26 PM

All replies