@@ -106,9 +106,9 @@ function Install-DbaMaintenanceSolution {
106106 . PARAMETER CheckSum
107107 Controls checksum validation in job commands. Valid values: Default, ForceOn, ForceOff, Remove.
108108 Default: uses Ola's default, which includes @Checksum = 'Y' in job commands.
109- ForceOn: explicitly sets @CheckSum = 'Y' in job commands.
110- ForceOff: explicitly sets @CheckSum = 'N' in job commands.
111- Remove: removes @CheckSum from job commands, letting the stored procedure's built-in default apply.
109+ ForceOn: explicitly sets @Checksum = 'Y' in job commands.
110+ ForceOff: explicitly sets @Checksum = 'N' in job commands.
111+ Remove: removes @Checksum from job commands, letting the stored procedure's built-in default apply.
112112 Only applies when InstallJobs is specified.
113113
114114 . PARAMETER ModificationLevel
@@ -843,18 +843,18 @@ function Install-DbaMaintenanceSolution {
843843 # CheckSum parameter for all backup jobs
844844 # Ola includes @Checksum = 'Y' by default. Default: leave unchanged.
845845 if ($CheckSum -eq " ForceOn" ) {
846- $modifiedCommand = $modifiedCommand -replace " @CheckSum = 'N'" , " @CheckSum = 'Y'"
847- if ($modifiedCommand -notmatch " @CheckSum " ) {
848- $modifiedCommand = $modifiedCommand -replace " (@LogToTable = '[YN]')" , " `$ 1,$ ( [System.Environment ]::NewLine) @CheckSum = 'Y'"
846+ $modifiedCommand = $modifiedCommand -replace " @Checksum = 'N'" , " @Checksum = 'Y'"
847+ if ($modifiedCommand -notmatch " @Checksum " ) {
848+ $modifiedCommand = $modifiedCommand -replace " (@LogToTable = '[YN]')" , " `$ 1,$ ( [System.Environment ]::NewLine) @Checksum = 'Y'"
849849 }
850850 } elseif ($CheckSum -eq " ForceOff" ) {
851- $modifiedCommand = $modifiedCommand -replace " @CheckSum = 'Y'" , " @CheckSum = 'N'"
852- if ($modifiedCommand -notmatch " @CheckSum " ) {
853- $modifiedCommand = $modifiedCommand -replace " (@LogToTable = '[YN]')" , " `$ 1,$ ( [System.Environment ]::NewLine) @CheckSum = 'N'"
851+ $modifiedCommand = $modifiedCommand -replace " @Checksum = 'Y'" , " @Checksum = 'N'"
852+ if ($modifiedCommand -notmatch " @Checksum " ) {
853+ $modifiedCommand = $modifiedCommand -replace " (@LogToTable = '[YN]')" , " `$ 1,$ ( [System.Environment ]::NewLine) @Checksum = 'N'"
854854 }
855855 } elseif ($CheckSum -eq " Remove" ) {
856- $modifiedCommand = $modifiedCommand -replace " @CheckSum = '[YN]',\r?\n" , " "
857- $modifiedCommand = $modifiedCommand -replace " ,\r?\n@CheckSum = '[YN]'" , " "
856+ $modifiedCommand = $modifiedCommand -replace " @Checksum = '[YN]',\r?\n" , " "
857+ $modifiedCommand = $modifiedCommand -replace " ,\r?\n@Checksum = '[YN]'" , " "
858858 }
859859
860860 # Update job step if command was modified
0 commit comments