Hi, I have a very simple script that changes a CSV file. When I run this via a Powershell console it works fine but if I try to run it in a Scheduled Task no changes are made, though the task said it ran successfully. I've tried running the task with highest privileges, a different account and running whether the user is logged on or not but nothing helps.
Code (c:\scripts\test.ps1):
$csv_info = Import-Csv c:\scripts\test.csv foreach ($line in $csv_info) { $log_drink = $line.Drink if ($log_drink -eq "Water") { $line.drink = $line.drink.replace("Water","Coke") } } $csv_info | Export-Csv test.csv -Delimiter ',' -NoType
The CSV file looks like so:
"Name","Drink"
"John","Water"
I also granted full permissions to 'Users' to the directory and files but it makes no difference. Does anyone have any tips?