I'm trying to execute the following command via command line
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Send-MailMessage -from "mail.me" -to "mail.me" -Subject "PS test !" -Body "Hi this is a power shell mail test" -SmtpServer "mail.domain.com"
But I'm getting the following error :
Send-MailMessage: A positional parameter cannot be found that accepts argument « test ».
Au niveau de ligne : 1 Caractère : 17
- Send-MailMessage <<<< -from mail.me -to mail.me -Subject PS test ! -Body Hi this is a power shell mail test -SmtpServer mail.domain.com
- CategoryInfo : InvalidArgument: (:) [Send-MailMessage], ParameterBindingException
- FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell
.Commands.SendMailMessage
The problem is that the same command works well when directly executed in Power Shell, but without the path.
What could be the problem generating this exception ?