Selecting the desired output

This topic contains 5 replies, has 2 voices, and was last updated by Profile photo of random commandline random commandline 6 months, 3 weeks ago.

  • Author
    Posts
  • #39035

    Hi ,

    Need assistance in below mentioned command output :-

    1) bpimagelist.exe -U -client CTSINBTPVIBBCA -d 05/06/2016 18:00:00 -e 05/09/2016 12:00:00 | Format-Table
    Backed Up Expires Files KB C Sched Type On Hold Index Status Policy
    —————- ———- ——– ——– – ————— ——- ———— ————
    05/06/2016 19:21 06/10/2016 11436 294973101 N Full Backup 0 0 BTP_VIBBCA
    05/06/2016 19:21 06/10/2016 33605 13033076 N Full Backup 0 0 BTP_VIBBCA
    05/06/2016 19:21 06/10/2016 16068 19758243 N Full Backup 0 0 BTP_VIBBCA

    2) bpimagelist.exe -U -client CTSINBTPVIBBCA -d 05/06/2016 18:00:00 -e 05/09/2016 12:00:00 | Select-Object "Backed Up", "KB"

    Backed Up KB
    ——— —

    I am trying to get 1st line from both the columns Backed up & KB.

    Kindly help.

  • #39038
    Profile photo of random commandline
    random commandline
    Participant

    You will have to split your text output then create objects. Are these your properties?

    Backed Up = 05/06/2016 19:21
    Expires = 06/10/2016
    Files = 11436
    KB = 294973101
    C Sched = N
    Type = Full Backup
    On Hold = 0
    Index = 0
    Status = BTP_VIBBCA
    Policy =

  • #39111

    Hi random commandline,

    Thanks for your reply.

    Kindly suggest, how can I split text output.

    Please help

  • #39123
    Profile photo of random commandline
    random commandline
    Participant

    In my previous post, I was asking if that information is correct. Is it? Is the backup, expires dates correct? Is KB correct?

  • #39177

    Yes the information is correct. The Dates & KB are correct.

    I wish for below mentioned output.

    Backed Up KB Policy
    —————- ——– —————
    05/06/2016 294973101 BTP_VIBBCA

    Please assist.

  • #39192
    Profile photo of random commandline
    random commandline
    Participant
    $list = bpimagelist.exe -U -client CTSINBTPVIBBCA -d 05/06/2016 18:00:00 -e 05/09/2016 12:00:00
    $list = $list -split "`n" ; $list = $list[2..$list.count]
    
    $results = foreach ($line in $list){
      $line = $line -split '\s'
      [PSCustomObject]@{
        BackedUp = $line[0..1] -join ' '
        KB = $line[4]
        Policy = $line[10]
        }  
    }
    $results | Format-Table -AutoSize
    
    # Results
    # BackedUp         KB        Policy
    #--------         --        ------
    # 05/06/2016 19:21 294973101 BTP_VIBBCA
    # 05/06/2016 19:21 13033076  BTP_VIBBCA
    # 05/06/2016 19:21 19758243  BTP_VIBBCA
    

You must be logged in to reply to this topic.