Author Posts

May 13, 2016 at 5:19 am

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.

May 13, 2016 at 6:04 am

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 =

May 16, 2016 at 12:49 am

Hi random commandline,

Thanks for your reply.

Kindly suggest, how can I split text output.

Please help

May 16, 2016 at 4:24 am

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

May 17, 2016 at 3:54 am

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.

May 17, 2016 at 5:39 am

$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