Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server SQL Server作业赢得';无法识别AWS CLI命令_Sql Server_Powershell_Amazon S3 - Fatal编程技术网

Sql server SQL Server作业赢得';无法识别AWS CLI命令

Sql server SQL Server作业赢得';无法识别AWS CLI命令,sql-server,powershell,amazon-s3,Sql Server,Powershell,Amazon S3,您好,我有一个SQL Server作业,其中的CmdExec步骤如下: powershell.exe -file D:\Script\test.ps1 目前,PowerShell脚本仅限于以下内容: aws s3 ls s3://backup-sql-day/ 奇怪的是,作业成功地运行了,这里有这样一条信息 The term 'aws' is not recognized as the name of a cmdlet, function, script file, or operable

您好,我有一个SQL Server作业,其中的
CmdExec
步骤如下:

powershell.exe -file D:\Script\test.ps1
目前,PowerShell脚本仅限于以下内容:

aws s3 ls s3://backup-sql-day/
奇怪的是,作业成功地运行了,这里有这样一条信息

The term 'aws' 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 D:\Script\teste.ps1:1 char:1 + aws s3 ls s3://backup-sql-day/ + ~~~ + CategoryInfo : ObjectNotFound: (aws:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException.Process Exit Code 0. The step succeeded. 术语“aws”不能识别为cmdlet、函数、脚本文件的名称, 或可操作程序。检查名称的拼写,或者是否包含路径, 请验证路径是否正确,然后重试。 在D:\Script\teste.ps1:1 char:1 +aws s3 ls s3://备份sql日/ + ~~~ +CategoryInfo:ObjectNotFound:(aws:String)[],CommandNotFoundException +FullyQualifiedErrorId:CommandNotFoundException.Process 退出代码0。 这一步成功了。 所以脚本没有运行,没有向我报告错误,问题是我似乎无法在SQL Server作业上运行任何AWS脚本,但是我可以对任何用户正常运行它,有人知道如何修复此问题吗?

错误消息(未混合)实际上是不言自明的。脚本确实运行,但找不到
aws
commandline工具。
path
环境变量中不包括AWS CLI安装的路径,或者SQL Server作业忽略系统环境

您可以通过在脚本中添加路径来解决此问题:

$env:Path += ';C:\Program Files\Amazon\AWSCLI'
aws s3 ls s3://backup-sql-day/

C:\Program Files\Amazon\AWSCLI
替换为工具安装到的文件夹。

问题是我使用python命令“pip install AWSCLI”安装了CLI,所以在C:\Program Files\Amazon上没有AWSCLI文件夹。@GabrielGuimarães应该使用MSI在Windows上安装它。不过,这并不能改变你需要做什么。找到
aws
命令行工具的位置,并将该文件夹添加到
路径
。我需要更改代码页(chcp 860),我需要最新版本的python才能工作。仅出于文档目的,这是我使用的行$环境:路径+=';C:\Program Files\Amazon\cfn bootstrap\;C:\ProgramFiles\Python35\Scripts\;C:\Program Files\Python35\\我必须在文件夹位置后附加“bin”才能访问“aws”命令