7

I just downloaded the latest version of AWS Powershell and tried this: Before I don't remember any problem. Now I am getting this error message:

PS C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell> Set-AWSCredentials -AccessKey xxxxxxxx -SecretKey xxxxxxx -StoreAs xxxx
Set-AWSCredentials : The term 'Set-AWSCredentials' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ Set-AWSCredentials -AccessKey xxxxxxx -SecretKey xxxxx
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Set-AWSCredentials:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell>

Does anyone have any ideas what I might be doing wrong? Has some syntax changed again :-(

Thanks

Anthony Neace
  • 25,013
  • 7
  • 114
  • 129
Alan2
  • 23,493
  • 79
  • 256
  • 450
  • you probably have to import the aws module using `Import-Module` – Martin Brandl Nov 03 '15 at 14:05
  • I have never imported any module before. Can you give me some more details. Note that I just downloaded and installed the AWS powershell and I am using the AWS powershell. Thanks – Alan2 Nov 03 '15 at 14:37
  • 1
    If you have just installed AWS toolkit, you may try closing the current powershell window and re-open it (assuming it was already open before the installation.) – Volkan Paksoy Nov 03 '15 at 14:48
  • @Alan Do you know what version of AWS PowerShell you were using previously? – Anthony Neace Nov 03 '15 at 14:52
  • Last time I used AWS PowerShell was about two months ago and it was the latest then. All I would like to do is to set the credentials :-( I tried it on two machines now. My experiences with AWS powershell have not been so great so far. Wish I did not have to say that but just my experience. – Alan2 Nov 03 '15 at 15:05
  • I should add both are fresh installs on Windows 10. I had hoped that after installing and opening I would not see problems like this. – Alan2 Nov 03 '15 at 15:09

2 Answers2

2

The tools install to a folder structure compliant with the auto-import support in PowerShell version 3 or higher, so Import-Module should not be needed.

It does however require that the PSModulePath update the installer performs takes effect, and we've noticed that on some systems you need to reboot after install.

Looking at PSModulePath you should see something like this (excuse wrapping):

PS C:\> ls env:PSModulePath | fl

Name  : PSModulePath
Value : C:\Users\userid\Documents\WindowsPowerShell\Modules;C:\Program
        Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files (x86)\AWS Tools\PowerShell\

If so, try restarting your machine and then open a shell prompt and see if Set-AWSCredentials becomes available. If not, report back and we'll try and repro.

henrycarteruk
  • 12,708
  • 2
  • 36
  • 40
Steve Roberts
  • 714
  • 4
  • 8
-1

try this two options:

  1. As @steve-roberts said, restart pc (didn't work for me)
  2. Install the latest Power shell version (https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-windows?view=powershell-7.1)

Best,