Hi,
I just start working with PowerShell Universal and have some problems. I add simple script (read childitem from path provided in param and export that data to csv). When I start that script in Script it’s working correctly, but when I schedule it in Schedules it return Error “Data at the root level is invalid. Line 1, position 1.” . Any idea what casue that?
I’m also having this problem when attempting to schedule a script that otherwise runs fine when I run it from the script. If I try to run it from the schedule, I get the same error.
Data at the root level is invalid. Line 1, position 1.
So, for testing I wrote a Test script with just Write-Output "Testing..." and that works in a schedule.
Otherwise, here is most of my script, I have the bit commented out that does the sftp upload at the moment, was just trying to get this part of it scheduled and working first.
Again, when running the script, it completes without any issues. When running from the schedule, it fails with that error.
If I comment out the param block, it appears to run and fail later due to the missing variables. Maybe it’s having an issue grabbing the pscreds secret variable or something?
Hmmm. Now I’m not really sure. I really thought it was 3.5.2 but I must have been mistaken. I just retested this on 3.5.4 and it is working for me. I used the same parameter block and passed in the credentials.