Я запускаю модуль Runbook в Octopus Deploy и получаю сообщение об ошибке ниже. Я не могу понять, в чем проблема. Помощь будет принята с благодарностью.
Скрипт:
function CleanupDBDailyBackupFolder {
Param(
$SourceFolder,
$DestinationFolder,
[int]$DaysFilesToKeep,
$WeeklyDBBackup
)
#Move the file that is 8 days old to different folder
$weeklyBackupFile = Get-ChildItem -Path $SourceFolder -Recurse | Where-Object
{$_.LastWriteTime.Date -eq $WeeklyDBBackup}
try {
Move-Item $weeklyBackupFile.FullName -Destination $DestinationFolder -Force
Write-Host "Weekly backup file is:" $weeklyBackupFile "and moved to" $DestinationFolder
} catch {
Write-Error $_
}
#Keep the last 7 days of DB backup files
$fileList = Get-ChildItem $SourceFolder -Recurse | Where-Object -FilterScript {
($_.LastWriteTime -le (Get-Date).AddDays($DaysFilesToKeep))}
foreach ($file in $fileList)
{
try {
Remove-Item $file.FullName -Force
Write-Host "List of files deleted"
Write-Host "Files deleted" $file
} catch {
Write-Error $_
}
}
Write-Host "Delete of files complete"
}
CleanupDBDailyBackupFolder $SourceFolder $DestinationFolder $DaysFilesToKeep $WeeklyDBBackup
Переменные, добавленные в Octopus: