[Solved] Update script database backup fails
Script version: v2.2.1
Updating from 1.4.7 to 1.4.8 fails with:
Backup the SQL Database Backup-SqlDatabase : System.Data.SqlClient.SqlError: Cannot open backup device '\\192.168.0.106\SCPUpgrade$\SolidCP - 2021-10-15 - (13.30 PM).bak'. Operating system error 5(Access is denied.). At C:\Users\Administrator\Downloads\SolidCP-Auto-Upgrade-Tool\SolidCP-Auto-Upgrade.ps1:417 char:7 + ... Backup-SqlDatabase -ServerInstance "$SCP_Database_Servr" ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Backup-SqlDatabase], SmoException + FullyQualifiedErrorId : ExecutionFailed,Microsoft.SqlServer.Management.PowerShell.BackupSqlDatabaseCommand
Can confirm that the share is open with access for everyone and works fine when accessing from anywhere on the network so not sure why the script is failing:
When I try to do a manual backup from SSMS to the same destination (\\192.168.0.106\SCPUpgrade$\SolidCP - 2021-10-15 - (13.30 PM).bak) I get the same error even though I can access the share from File Exporer, so seems like some kind of issue accessing it from the account that SQL Server is running on. Not sure why that would be though, if "Everyone" has full access to ther share.
I guess both systems need identical accounts on them for that to work. All good now.