sql server: using Powershell, get the list of backup and verify in SAN

Using the dbatools below command, we obtain a backup history of all our instances

    Get-DbaBackupHistory -SqlInstance SqlInstance2014a

Once the backups are completed, the process copies them to SAN, which we verify using this command

dir "\ SQL Backups  2019  6" -Recurse -Filter * .bak -ErrorAction SilentlyContinue -Force | select LastWriteTime, Name | Where-Object {$ _. LastWriteTime -ge [DateTime]:: Now.AddDays (-2)}

I'm struggling to combine them, requires following

  • Make a backup of the list on the server and then look for them in san to verify that they were copied; send this by email.