I am not certain if this is PowerGadgets related or PS, but when I attempt to create an out-chart using a multi-line PS command it locks the script until I close the chart and then continues but in unexpected ways. For instance the line
Get-WmiObject -class Exchange_Mailbox -Namespace ROOT\MicrosoftExchangev2 ` -ComputerName EMAIL | Select-Object MailboxDisplayName, Size, TotalItems ` | sort Size -descending | select -first 20 | out-chart -Values Size, ` TotalItems -Label MailboxDisplayName -template EmailReport | send-mail ` -From PowerGadgets@domain.com -To user@domain.com -subject ` "Top 20 Email Users" -Text "This is a test" -server email.domain.com
creates the Outchart correctly, but stops at that point and when I close the chart it emails the user but does not include the chart. However if I put it all on one line like so
Get-WmiObject -class Exchange_Mailbox -Namespace ROOT\MicrosoftExchangev2 -ComputerName EMAIL | Select-Object MailboxDisplayName, Size, TotalItems | sort Size -descending | select -first 20 | out-chart -Values Size, TotalItems -Label MailboxDisplayName -template EmailReport | send-mail -From PowerGadgets@jdomain.com -To user@domain.com -subject "Top 20 Email Users" -Text "This is a test" -server email.domain.com
The script runs and the user gets the chart in email as expected. Should I be doing a different method for multilining for readability?