There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Timeouts on Invoke -Sqlcmd
We've had the Framework installed and running since December (thanks again, this thing is great). In just the last week we've suddenly started getting errors:
A job step received an error at line 101 in a PowerShell script. The corresponding line is 'Invoke-Sqlcmd -ServerInstance $CentralManagementServer -Database $HistoryDatabase -Query "exec policy.epm_LoadPolicyHistoryDetail" -ErrorAction Stop'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Command execution stopped because the shell variable "ErrorActionPreference" is set to Stop: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. '. Process Exit Code -1. The step failed.
I checked our server for issues, blocked processes, full drives, the usual, and didn't find anything. I tried running the procedure by itself and it completed in about 12 seconds. So, I looked at the PowerShell scripts. I couldn't find a timeout setting that would negatively impact the execution of the procedure, but I also didn't see anything that would positively impact it. So, I modified the script as follows:
Invoke-Sqlcmd -ServerInstance $CentralManagementServer -Database $HistoryDatabase -Query "exec policy.epm_LoadPolicyHistoryDetail" -ErrorAction Stop -QueryTimeout 0
Adding the QueryTimeout and setting it to 0 seemed to solve the problem. Do you think that's OK or is there something else I should look at?