@@ -64,6 +64,9 @@ function Set-RsDatabase
64
64
This credential is used for *setup* only; it is not used for PowerBI Report Server during runtime.
65
65
Note: This parameter will be ignored whenever AdminDatabaseCredentialType is set to Service Account!
66
66
67
+ . PARAMETER QueryTimeout
68
+ Specify how many seconds the query will be running before exit by timeout. Default value is 30.
69
+
67
70
. EXAMPLE
68
71
Set-RsDatabase -DatabaseServerName localhost -Name ReportServer -DatabaseCredentialType ServiceAccount
69
72
Description
@@ -120,7 +123,10 @@ function Set-RsDatabase
120
123
$ComputerName ,
121
124
122
125
[System.Management.Automation.PSCredential ]
123
- $Credential
126
+ $Credential ,
127
+
128
+ [int ]
129
+ $QueryTimeout = 30
124
130
)
125
131
126
132
if ($PSCmdlet.ShouldProcess ((Get-ShouldProcessTargetWmi - BoundParameters $PSBoundParameters ), " Configure to use $DatabaseServerName as database, using $DatabaseCredentialType runtime authentication and $AdminDatabaseCredentialType setup authentication" ))
@@ -198,11 +204,11 @@ function Set-RsDatabase
198
204
{
199
205
if ($isSQLAdminAccount )
200
206
{
201
- Invoke-Sqlcmd - ServerInstance $DatabaseServerName - Query $SQLScript - ErrorAction Stop - Username $adminUsername - Password $adminPassword
207
+ Invoke-Sqlcmd - ServerInstance $DatabaseServerName - Query $SQLScript - QueryTimeout $QueryTimeout - ErrorAction Stop - Username $adminUsername - Password $adminPassword
202
208
}
203
209
else
204
210
{
205
- Invoke-Sqlcmd - ServerInstance $DatabaseServerName - Query $SQLScript - ErrorAction Stop
211
+ Invoke-Sqlcmd - ServerInstance $DatabaseServerName - Query $SQLScript - QueryTimeout $QueryTimeout - ErrorAction Stop
206
212
}
207
213
}
208
214
catch
@@ -236,11 +242,11 @@ function Set-RsDatabase
236
242
{
237
243
if ($isSQLAdminAccount )
238
244
{
239
- Invoke-Sqlcmd - ServerInstance $DatabaseServerName - Query $SQLScript - ErrorAction Stop - Username $adminUsername - Password $adminPassword
245
+ Invoke-Sqlcmd - ServerInstance $DatabaseServerName - Query $SQLScript - QueryTimeout $QueryTimeout - ErrorAction Stop - Username $adminUsername - Password $adminPassword
240
246
}
241
247
else
242
248
{
243
- Invoke-Sqlcmd - ServerInstance $DatabaseServerName - Query $SQLScript - ErrorAction Stop
249
+ Invoke-Sqlcmd - ServerInstance $DatabaseServerName - Query $SQLScript - QueryTimeout $QueryTimeout - ErrorAction Stop
244
250
}
245
251
}
246
252
catch
0 commit comments