Power Shell Invoke-SQLSelect : Exception calling "Fill" with "1" argument(s):

Viewed 35

I am getting this error while running a power shell script

Invoke-SQLSelect : Exception calling "Fill" with "1" argument(s): "Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding."

# Import functions file for Database Access
Import-Module C:\apps\powerShell\RLID\SQLDatabaseAccess.ps1 -Force

$Connection=Connect-SQLServer -InstanceName "GP-SQLDB-300,33416" -DatabaseName "VepoBackFlow" -IntegratedSecurity $true

Invoke-SQLSelect -Connection $Connection -SelectStatement "EXECUTE dbo.UpdateVepoMeterNum"

Invoke-SQLSelect -Connection $Connection -SelectStatement "EXECUTE dbo.InsertLogRecord 'CompareMeter.ps1','Insert Row to VEPO_OUT', 'ew1844','execute dbo.UpdateVepoMeterNum'"

Close-SQLServerConeection -Connection $Connection
1 Answers

After trying many things, I found the solution by programmatically setting the time out to 10 minutes, that seems to solve the issue.

$SQLCommand.CommandTimeout = 640
Related