Timeout issue in Backup-SQLDatabase cmdlet Timeout issue in Backup-SQLDatabase cmdlet powershell powershell

Timeout issue in Backup-SQLDatabase cmdlet


I did some research on this and came around the following workaround :

$serverConn = new-object ("Microsoft.SqlServer.Management.Smo.Server") $server$serverConn.ConnectionContext.StatementTimeout = 0

Backup-SqlDatabase -InputObject $serverConn -Database abc -BackupFile "L:\123\abc.bak" 

When we pass Server name as a string, it tries to create it's own connection and we don't have the option to change QueryTimeout from 600 to 0.

However, we can create a SMO.Server object and use it after setting desired properties.

Hope it helps!