@@ -90,7 +90,7 @@ function Install-DbaMaintenanceSolution {
90
90
https://ola.hallengren.com
91
91
92
92
. LINK
93
- https://dbatools.io/Install-DbaMaintenanceSolution
93
+ https://dbatools.io/Install-DbaMaintenanceSolution
94
94
95
95
. EXAMPLE
96
96
PS C:\> Install-DbaMaintenanceSolution -SqlInstance RES14224 -Database DBA -InstallJobs -CleanupTime 72
@@ -402,12 +402,6 @@ function Install-DbaMaintenanceSolution {
402
402
$cleanupQuery = $null
403
403
if ($ReplaceExisting ) {
404
404
[string ]$cleanupQuery = $ ("
405
- IF OBJECT_ID('[dbo].[CommandLog]', 'U') IS NOT NULL
406
- DROP TABLE [dbo].[CommandLog];
407
- IF OBJECT_ID('[dbo].[QueueDatabase]', 'U') IS NOT NULL
408
- DROP TABLE [dbo].[QueueDatabase];
409
- IF OBJECT_ID('[dbo].[Queue]', 'U') IS NOT NULL
410
- DROP TABLE [dbo].[Queue];
411
405
IF OBJECT_ID('[dbo].[CommandExecute]', 'P') IS NOT NULL
412
406
DROP PROCEDURE [dbo].[CommandExecute];
413
407
IF OBJECT_ID('[dbo].[DatabaseBackup]', 'P') IS NOT NULL
@@ -418,6 +412,22 @@ function Install-DbaMaintenanceSolution {
418
412
DROP PROCEDURE [dbo].[IndexOptimize];
419
413
" )
420
414
415
+ if ($LogToTable ) {
416
+ $cleanupQuery += $ ("
417
+ IF OBJECT_ID('[dbo].[CommandLog]', 'U') IS NOT NULL
418
+ DROP TABLE [dbo].[CommandLog];
419
+ " )
420
+ }
421
+
422
+ if ($InstallParallel ) {
423
+ $cleanupQuery += $ ("
424
+ IF OBJECT_ID('[dbo].[QueueDatabase]', 'U') IS NOT NULL
425
+ DROP TABLE [dbo].[QueueDatabase];
426
+ IF OBJECT_ID('[dbo].[Queue]', 'U') IS NOT NULL
427
+ DROP TABLE [dbo].[Queue];
428
+ " )
429
+ }
430
+
421
431
if ($Pscmdlet.ShouldProcess ($instance , " Dropping all objects created by Ola's Maintenance Solution" )) {
422
432
Write-ProgressHelper - ExcludePercent - Message " Dropping objects created by Ola's Maintenance Solution"
423
433
$null = $db.Invoke ($cleanupQuery )
0 commit comments