我正在尝试使用以下代码保存凭据:
$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凭据请求”。如何摆脱这个查询,因为凭证存储?