Powershell script output to email not working with "send-mailmessage: Cannot validate argument on parameter ´Body´
hi,
i bloody beginner ps , had getting point @ i´m stuck. the ps1 runs fine , csv output correct when attempting "send report mail..." receive error in subject line , have tried working.
$params = @{
# inlineattachments =
attachments = $logfilepath # 'c:\temp\attachment1.txt', 'c:\temp\attachment2.txt'
body = "please find attached completed listing of users included in summaryreport $today"
bodyashtml = $false
subject = “finished - $scriptname”
from = 'group-scripts@company.com'
to = 'group@company.com','me@company.com'
# bcc =
smtpserver = 'server.internal.company.com'
# priority = 'high'
# port = 587
# credential = (get-credential)
# usessl = $true
}
writelogfile("send report mail...")
send-mailmessage @params
if assist quickly, appreciate behind on deadline.
thank , best regards,
jerome13
still can't reproduce error you're getting.
edit: this looks wrong:
writelogfile("******************************************************************") writelgofile function, , not syntax passing argument function in powershell.
it should like:
writelogfile "******************************************************************"
or
writelogfile -info "******************************************************************"
i think may messing params hash table, , causing subsequent failure of send-mailmessage.
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Windows Server > Windows PowerShell
Comments
Post a Comment