We have a network share that uses different credentials from the currently logged in user. Inside this share we have full, differential and log backups that come through from a third party database that are updated daily.
I've been tasked with automating the restoration of these backups to a local database.
What's the best way to go about designing and implementing a solution for this?
As can be seen above, there are multiple files in each folder with different file names depending on the date, etc.
Update:
Following on from the solution posted below, I had to modify the suggested PowerShell code slightly in order to make it work:
$pass ="xxx"|ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object System.Management.Automation.PsCredential('Domain\Account',$pass)
New-PSDrive -Name K -PSProvider "FileSystem" -Credential $cred -Root '\\UNC PATH TO FOLDER WHERE BACKUP IS STORED';
Get-PsDrive;
Copy-Item K:\ -Recurse M:\DESTINATION;
Restore-DbaDatabase -server MRVAPPSQL01 -path M:\DESTINATION -MaintenanceSolutionBackup -WithReplace;
Remove-PSDrive -Name K;
Remove-Item M:\DESTINATION\*.*;