1

I'm using the AWS Powershell tools.

When I run the following, I get a message from the cmdlet.

(Set-AWSCredentials -AccessKey $key -SecretKey $secret -StoreAs "default") > $null

I get the following message:

INFO: Credentials loaded from the supplied key parameters

How can I prevent this message from being written to the host? I attempted redirecting using *> as well, yet the message remains.

4

2 回答 2

1

The cmdlet seems to write that info message to the host program. Something like this might work:

powershell -Command "Set-AWSCredentials -AccessKey '$key' -SecretKey '$secret' -StoreAs 'default'" >$null

When you run a command in a separate host program, the host output of that program appears in the success output stream of its parent host program.

于 2014-10-21T17:21:20.970 回答
0

I think you could have replaced "> $null" with "| out-null". The latter uses native Powershell pipeline control to send to null.

or,

[void](Set-AWSCredentials -AccessKey $key -SecretKey $secret -StoreAs "default")

于 2015-05-13T17:14:51.667 回答