Gab*_*ães 4 sql-server powershell amazon-s3
您好我有一个SQL Server作业,其CmdExec步骤如下:
powershell.exe -file D:\Script\test.ps1
Run Code Online (Sandbox Code Playgroud)
目前PowerShell脚本就是这样的:
aws s3 ls s3://backup-sql-day/
Run Code Online (Sandbox Code Playgroud)
而且奇怪的是,这份工作非常出色,并且有这样的信息.
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.
因此脚本不运行,不报告错误,事情是我似乎无法在SQL Server作业上运行任何AWS脚本,但是我可以正常运行任何用户,是否有人知道如何解决这个问题?
(unmangled)错误消息实际上是不言自明的.该脚本确实运行,但找不到aws命令行工具.AWS CLI安装的路径未包含在PATH环境变量中,或者SQL Server作业忽略系统环境.
您可以通过在脚本中添加路径来解决此问题:
$env:Path += ';C:\Program Files\Amazon\AWSCLI'
aws s3 ls s3://backup-sql-day/
Run Code Online (Sandbox Code Playgroud)
替换C:\Program Files\Amazon\AWSCLI安装工具的任何文件夹.
| 归档时间: |
|
| 查看次数: |
3286 次 |
| 最近记录: |