title: Why does powershell run from scheduled task not recognise aws-cli credentials in user directory?
body: <p>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'.</p>
  
  <p>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.</p>
  
  <p>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:</p>
  
  <p><code>Unable to locate credentials. You can configure credentials by running "aws configure".</code></p>
  
  <p>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.</p>