Ошибка в скрипте Send-MailMessage
$SmtpServer = "smtp.server"
$From = "myself@email"
$To = "friend@email"
$Subject = "Weekly Admin Points Backup"
$Body = @"
Hello....
"@
$attachment = "F:\AdminPoints.docx"
Send-MailMessage -To $To -From $From -Subject $Subject -Body $Body -Attachments $attachment -SmtpServer $SmtpServer
Я получаю эту ошибку при попытке выполнить простой скрипт PowerShell с вложением:
Send-MailMessage : The process cannot access the file '*<Filepath>*' because it is being used by another process.
At <*script>*.ps1:9 char:17
+ Send-MailMessage <<<< -To $To -From $From -Subject $Subject -Body $Body -Attachments $attachment -SmtpServer $SmtpServer
+ CategoryInfo : NotSpecified: (:) [Send-MailMessage], IOException
+ FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.SendMailMessage
Любые идеи, что я могу сделать, чтобы решить?