AWS Powershell commands are not running from Jenkins server

  amazon-web-services, jenkins, powershell, windows

I have jenkins job to list out all my ec2 instances using AWS powershell commands, But I am getting below error.

Get-EC2Instance: No credentials specified or obtained from persisted/shell

however added the credentials file under C:Users{user name}.aws directory

If I run the aws cli commands from the jenkins job , Its working as expected.

If I logged into vm and run the AWS powershell commands , Its working as expected but from jenkins its not working.

Source: Windows Questions