I have a PowerShell script which copies backups from a production environment and restores them to a local sql server instance in order to perform some operations on the database then re-backs them up to a local drive.
Part of this command uses the Restore-SqlDatabase command.
This errors due to a sector size difference in my machine (4096) and the production environment (512).
Cannot use the backup file '.bak' because it was originally formatted with sector size 512 and is now on a device with sector size 4096
I want to automate this workflow so am looking for a way to run this script regardless of the sector size of the target machine or the production environment. Is there anyway within PowerShell to get around this issue?
Restore-SqlDatabase -ServerInstance $DatabaseServer -Database $DatabaseName -RelocateFile $relocate -BackupFile $BackupFilePath -RestoreAction Database
I am aware of the answers in this question, but specifically I want to do this in powershell (with the Restore-SqlDatabase command), not SQL.