I've got a powershell script to archive log files. The script is intended to be run daily from a scheduled task as a specified user 'LogArchiver'.
The script uses the aws-cli to copy the file to S3 and needs sufficient credentials to access the bucket which are stored in the user directory C:\Users\LogArchiver\.aws as recommended in the aws docs.
When I run the script from a powershell terminal running as the user it recognises the credentials and successfully copies files to S3. But when it is run from the scheduled task it doesn't recognise the aws credentials and writing the Transcript to file shows the message:
Unable to locate credentials. You can configure credentials by running "aws configure".
Anyone know why this is and any fixes to it? I've read in another post about scheduled tasks doing funny things to environment variables but not sure if that would cause the problems i'm having.