coesum Posted July 17, 2007 Report Share Posted July 17, 2007 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? Quote Link to comment Share on other sites More sharing options...
marco.shaw Posted July 17, 2007 Report Share Posted July 17, 2007 You cannot split the lines in this case. This is basically a PowerShell limitation currently:http://community.softwarefx.com/forums/t/9104.aspx You can, however, do different things to cut things down, but it will still require extra steps/scripting:http://community.softwarefx.com/forums/t/9041.aspx Other than that, you're left with possibly using the built-aliases like 'gwmi' instead of 'get-wmiobject'. Most of the built-in cmdlets have aliases for their parameters. PowerGadgets doesn't currently support shorter counterparts for the parameters, but it is something I've suggested before. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.