我正在尝试使用 TFS 构建在构建后脚本中执行少数 aws cmdlet 命令。我在构建控制器中安装了 AWS SDK 工具。我可以在构建控制器中手动运行相同的命令。但是当我在 TFS 后构建脚本中调用这些命令时。它给我一个错误,它无法找到安装在构建控制器上的 cmdlet。我试图更改执行策略但没有帮助。我有一个执行策略 - 现在绕过。脚本正在执行,但只有命令无法执行。我认为这是因为执行政策之类的问题。当我们从 power shell 调用任何第三方 cmdlet 时,我们是否需要检查其他类似执行策略的内容。
命令:
Set-AWSCredentials -AccessKey -SecretKey
Set-DefaultAWSRegion -Region us-east-1
Write-S3Object -BucketName agero-source-package -File "\\b tfadfa\adfa\adf\asdf\adsf\asdf\asd\xyz.zip"
错误:
Set-DefaultAWSRegion : The term 'Set-DefaultAWSRegion' 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 \\b-tfsbc001wv\c$\MV\BuildETA-API.ps1:41 char:26
+ cd "\\b-tfsbc001wv\C$" | Set-DefaultAWSRegion -Region us-east-1
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Set-DefaultAWSRegion:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Write-S3Object : The term 'Write-S3Object' 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 \\b-tfsbc001wv\c$\MV\BuildETA-API.ps1:43 char:26
+ cd "\\b-tfsbc001wv\c$" | Write-S3Object -BucketName agero-source-package -File " ...
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Write-S3Object:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException