I hacked together a PowerShell script that backs up a very large MS-SQL database, copies it to a remote location, verifies the copy is complete, then emails me a report to let me know whether or not the run was successful.
The SQL backup is ~600 GB (it's a database of document images). The script gets to the Copy-Item step and then seems to just quit running. The copy does complete, but the remaining steps in the script are never executed. The source/destination backup files are never compared post copy, the source file is not deleted (which means I have no disk space to run the subsequent full backup :-D), I don't get the success/failure email, and it doesn't "clean up" after itself (delete the log files). All of the logging I do also seems to indicate that the script up and "stops" at the Copy-Item stage (no log entries after this step is executed).
The SQL backup takes ~1.5 hours to complete and the copy takes ~1.5 hours to complete. Am I hitting a PowerShell session timeout of some sort? If so, how can I extend the timeout?
QUICK ADD: I forgot to add that this script was working in the past. I don't recall when this started happening (maybe a month ago), but I suspect it has something to do with some threshold I've hit in terms of how long the script is running (the database backup was ~400 GB when I hacked this script together some 2 years ago).
QUICK ADD 2: The script actually runs longer as it also verifies that the backup is good with SQL before initiating the copy, and it looks like that takes an hour. So 1.5 hours to run the backup, another hour for SQL to verify the backup, then another 1.5 hours for the backup to be copied to a remote location. So we're looking at ~4 hours.