I need to create an object and each iteration add values to. The problem what i have is I thing with the logic of the code. I think I have to create another foreach and place New-Object psobject -Property $object outside...but i don't know how to do it.
Can someone help me?
Import-Module BEMCLI  #BackupExec
$object= @{}
#For each last 15 job backups
ForEach ($i in $(Get-BEJob "FULL" | Get-BEJobHistory -FromStartTime (Get-Date).AddDays("-15") -JobType Backup))
 { 
 $object.TAPE= ($i | Get-BEJobLog | Get-BEJobLogFiles) # get Tape
 $object.START_TIME=$i.StartTime #get starttime
 $object.END_TIME=$i.EndTime #get endtime
 New-Object psobject -Property $object
 } 
$object | ft