Тестирование для другого скрипта. Я работаю над ним, но у меня проблемы с новой группой файлов. Смотри ниже. $ Attach2 вызывает ошибку, в то время как $ Attachment1 работает нормально
$Attachment1 = "c:\temp\I went to the beach-and now too.txt"
$Attach2 = '\\qa-west\e$\orders\15557__45747457-Re_[EXTERNAL]SomeBoxShipmentTestName-JoeSmithers-FileWest-232264_42211_3674745752.msg'
$smtpServer = "mail.somewhare.com"
try{
Send-MailMessage -From 'nobody@somwhare.com' -To 'testdev@somewhare.com' -Subject 'test sub' -Body 'this is body' -SmtpServer $smtpServer -Attachments $Attachment1
}
catch {
# log the error
$ErrorMessage = $PSItem.Exception.Message
#-- test
Write-Host $ErrorMessage
}
Сбой Send-MailMessage за исключением:
Исключение: System.IO.FileNotFoundException: невозможно найти указанный файл. \ R \ n в System.Management.Automation.MshCommandRuntime.ThrowTerminatingError (ErrorRecorderrorRecord)
ErrorDetails:Cannot perform operation because the wildcard path did not resolve to a file FileName $null