I have a script that goes out and retrieves a CSV file and outputs a modified version of that dataset. The issue I am facing is since moving this script from a Windows Scheduled Task to PowerShell Universal, the script does not retrieve the entire contents of the CSV file. When it runs as part of the scheduled jobs in PowerShell Universal, it returns a varying list of incomplete data. There are normally over 1400 entries in the CSV file, however the script will return different amounts each time when run as part of the schedule. I even added a check and second Import-Csv command, but it still doesn’t return the entire CSV file. I’ve tried modifying the environment from Posh 5.1 to Pwsh 7.1.3, to no avail.
Automatic Job Results:
July 5 - 162 (2nd pass: 535)
June 28 - 331 (2nd pass: 765)
June 21 - 234 (2nd pass: 259)
June 14 - 61 (2nd pass: 92)
If I run it manually, I’m getting the entire CSV:
July 5 - 1479 (confirmed a new line was added)
June 28 - 1478
June 21 - 1478
June 14 - 1478
Is there any obvious explanation why the automated task would behave differently? I am using the same “Run As” account as the scheduled task when performing the manual invocation.
Product: PowerShell Universal Version: 1.5.19