6

我刚刚下载了最新版本的 AWS Powershell 并尝试了这个:之前我不记得有任何问题。现在我收到此错误消息:

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>

有谁知道我可能做错了什么?有一些语法再次改变:-(

谢谢

4

2 回答 2

3

这些工具安装到与 PowerShell 版本 3 或更高版本中的自动导入支持兼容的文件夹结构中,因此Import-Module不需要。

但是,它确实要求PSModulePath安装程序执行的更新生效,并且我们注意到在某些系统上您需要在安装后重新启动。

看着PSModulePath你应该看到这样的东西(借口包装):

PS C:\> ls env:PSModulePath | 佛罗里达州

名称:PSModulePath
值: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\

如果是这样,请尝试重新启动计算机,然后打开 shell 提示符并查看是否Set-AWSCredentials可用。如果没有,请报告,我们将尝试复制。

于 2015-11-03T17:18:30.767 回答
0

试试这两个选项:

  1. 正如@steve-roberts 所说,重启电脑(对我不起作用)
  2. 安装最新的 Power shell 版本 ( https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-windows?view=powershell-7.1 )

最好的,

于 2021-02-10T15:06:11.133 回答