
(EX: a ps1 or even exe file) issue still is there (with all but the powershell command one), so the issue is powershell does not like passing the proper path. Update: even with putting something other than a bat file. I know all versions of the scripts/command line/batch file connect to the mail server. I figure it has to be run using power shell. When the batch file failed, manually ran SendEmail.ps1 from Windows by right mouse clicking on the PS1 file and selecting 'Run with PowerShell' No email was sent. When I double click the file I get 'access is denied'. ^Path should be ' C:\Users\someone\Downloads\Script-master (3)' I created a basic batch file that uses 'net share' to share a local path. 'C:\Users\someone\Downloads\Script-master' is not recognized as an internal or external command, operable program or batch file. Start-Process powershell.exe "File.bat $UpArg"Įdit: Error given (sorry thought i had this posted) I have tried the following (with using full path and with using just the file name) Start-Process cmd.exe "/k $BatFile $UpArg" It seems like for some odd reason it does not like the brackets in the path If the file path is ' C:\Users\someone\Downloads\Script-master' it work If the file path is ' C:\Users\someone\Downloads\Script-master (3)' it does not work (which is what makes me think it is powershell script that is causing the issue) it works fine when used at the powershell/command prompt. If the "-To" or "-From" address is intentionally misspelled the mail server correctly reports the error.I made a batch script. When the batch file failed, manually ran SendEmail.ps1 from Windows by right mouse clicking on the PS1 file and selecting "Run with PowerShell" Send-MailMessage -SmtpServer 192.168.15.12 -To -From -Subject 'Sent from Inside Power Shell App' -building 'This is the building of the message' Then changed the batch file to call PS1 script "SendEmail.ps1". Powershell Send-MailMessage -SmtpServer 192.168.15.12 -To -From -Subject 'Sent from Inside Power Shell App' -building 'This is the building of the message' The command runs without error or warning.ĭifferent formats were used in the batch file. PS C:\> Send-MailMessage -SmtpServer 192.168.15.12 -To -From -Subject 'Sent from Inside Power Shell App' -building 'This is the building of the message'įrom a batch file or the command line this command fails to send email. This is the command line used to send email. If powershell is first started email can be successfully sent using the PS command line.
