无法保存凭据

时间:2015-08-04 11:58:05

标签: powershell-v4.0

我正在尝试使用以下代码保存凭据:

$user = "test@mail.ru"
$password = Get-Content pass.txt | ConvertTo-SecureString
$credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $user,$password

Send-MailMessage -To test@mail.ru -Subject Test -Body Check -SmtpServer smtp.domen.ru -From test@mail.ru -Credential $credentials

现在,当您运行PowerShell脚本时 - 生成表单输入密码“Windows PowerShell凭据请求”。如何摆脱这个查询,因为凭证存储?

enter image description here

0 个答案:

没有答案