SQLTeam.com | Weblogs | Forums

Powershell Script for Copying backup files and capture results in output file with specific details

Hi Team - I have the below PowerShell script which is working for me to capture the results for one set of backup file but my requirement is to copy 10 or more backups files parallelly to a shared location and capture the result and append the result to the result_log .CSV format....with the following result set....
Can someone help me modify the script to capture these results plz ? I am a newbie to PowerShell
DBName BackupPathAndName BackupSizeMB CopyStartDateTime CopyEndDateTime DurationSeconds

--Working Powershell Script

Start-Transcript
$Password = ConvertTo-SecureString -AsPlainText -Force -String "Password"
$User = "UserName"
$credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $user,$password
$item = get-item 'C:\Temp\BackupFileName.bak'
$time=Measure-Command -Expression {Copy-Item -literalpath 'C:\Temp\BackupFileName.bak' '\IP\Shared\TEST\BackupFileName.bak'}
$TransferRate = ($item.length/1024/1024) / $time.TotalSeconds
write-host "$TransferRate MB/Sec"
$result = New-Object -TypeName psobject -Property @{
Source = $item.fullname
TimeTaken = $time.TotalSeconds
TransferRateMBs = $TransferRate
}
$result|Export-Csv 'C:\temp\Result_Log.CSV' -Force -Append -NoTypeInformation
Stop-Transcript