diff --git a/Chapter03/Listing 1 - Create Scheduled Task.ps1 b/Chapter03/Listing 1 - Create Scheduled Task.ps1 index a2bd05f..0100a54 100644 --- a/Chapter03/Listing 1 - Create Scheduled Task.ps1 +++ b/Chapter03/Listing 1 - Create Scheduled Task.ps1 @@ -7,7 +7,7 @@ $Execute = "C:\Program Files\PowerShell\7\pwsh.exe" # Set Action arguments $Argument = '-File ' + '"C:\Scripts\Invoke-LogFileCleanup.ps1"' + - ' -LogPath "L:\Logs\" -ZipPath "L:\Archives\"' + + ' -LogPath "L:\Logs" -ZipPath "L:\Archives"' + ' -ZipPrefix "LogArchive-" -NumberOfDays 30' # Create the Scheduled Task Action @@ -24,4 +24,4 @@ $ScheduledTask = @{ Action = $Action User = 'NT AUTHORITY\SYSTEM' } -Register-ScheduledTask @ScheduledTask \ No newline at end of file +Register-ScheduledTask @ScheduledTask diff --git a/Chapter03/Listing 3 - Importing Multiple a Scheduled Tasks.ps1 b/Chapter03/Listing 3 - Importing Multiple a Scheduled Tasks.ps1 index 6de2df4..076d405 100644 --- a/Chapter03/Listing 3 - Importing Multiple a Scheduled Tasks.ps1 +++ b/Chapter03/Listing 3 - Importing Multiple a Scheduled Tasks.ps1 @@ -4,9 +4,9 @@ $Share = "\\srv01\PoSHAutomation\" $TaskFiles = Get-ChildItem -Path $Share -Filter "*.xml" # parse through each file and import the job -foreach($task in $TaskFiles){ +foreach($FilePath in $TaskFiles){ $xml = Get-Content $FilePath -Raw [xml]$xmlObject = $xml $TaskName = $xmlObject.Task.RegistrationInfo.URI Register-ScheduledTask -Xml $xml -TaskName $TaskName -} \ No newline at end of file +} diff --git a/Chapter03/Listing 4 - Watch-Folder.ps1.ps1 b/Chapter03/Listing 4 - Watch-Folder.ps1.ps1 index 29b0e62..3377c2b 100644 --- a/Chapter03/Listing 4 - Watch-Folder.ps1.ps1 +++ b/Chapter03/Listing 4 - Watch-Folder.ps1.ps1 @@ -81,4 +81,3 @@ foreach ($file in $sorted) { break } } -} \ No newline at end of file