DbUp setting command timeout in PowerShell (ExecutionTimeout)

I needed to increase the command timeout in DbUp from the default 30s to 10min and all examples that I found were in C#.

The good news is that PowerShell support of .net is really good and I manage to even use a callback function:


$dbUp = [DbUp.DeployChanges]::To
$dbUp = [SqlServerExtensions]::SqlDatabase($dbUp, $constr)
$dbUp = [StandardExtensions]::WithScriptsFromFileSystem($dbUp, $scriptPath)

$dbUp.Configure({ param($c); $c.ScriptExecutor.ExecutionTimeoutSeconds = 10 * 60 }) # 10 min command timeout

$dbUp = [StandardExtensions]::LogToConsole($dbUp)
$upgradeResult = $dbUp.Build().PerformUpgrade()

If you want to use DbUp for database maintenance script automation check here.

Reference article with C# timeout setting solution here.

DbUp setting command timeout in PowerShell (ExecutionTimeout)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s