He escrito un script de PowerShell que creará un correo electrónico, sin embargo, parece que no puedo adjuntar un archivo. El archivo existe y PowerShell puede abrirlo, ¿alguien podría decirme qué estoy haciendo mal?Cómo adjuntar un archivo a un correo electrónico con PowerShell
$ol = New-Object -comObject Outlook.Application
$message = $ol.CreateItem(0)
$message.Recipients.Add("Deployment")
$message.Subject = "Website deployment"
$message.Body = "See attached file for the updates made to the website`r`n`r`nWarm Regards`r`nLuke"
# Attach a file this doesn't work
$file = "K:\Deploy-log.csv"
$attachment = new-object System.Net.Mail.Attachment $file
$message.Attachments.Add($attachment)
También estoy usando Powershell 2 – TheLukeMcCarthy