Powershell : Send-MailMessage -Body paramenters is not working with commands like (Get-ExchangeServer) etc

I am trying to send email from Powershell .
When i run this:
Send-MailMessage -From "[email protected]" -To "[email protected]" -Subject "Test email" -Body  "This is Test Email" -SmtpServer "mail01.xxx.xx"
then i successfully receive email .
But when i try to use other commands in -Body parameter then it gives error:
For example:
 Send-MailMessage -From "[email protected]" -To "[email protected]" -Subject "Test email"
-Body (Get-ExchangeServer) -SmtpServer "mail01.xxx.xx"
Send-MailMessage : Cannot convert 'System.Object[]' to the type 'System.String'
 required by parameter 'Body'. Specified method is not supported.
At line:1 char:96At line:1 char:116
+ Send-MailMessage -From "[email protected]" -To "[email protected]" -Subject "Test email" -Body (Get-ExchangeServer <<<< ) -SmtpServer "mail01.xxx.xx"
    + CategoryInfo          : ObjectNotFound: (Get-ExchangeServer:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
My requirement is to send email from powershell and send exchange related data in email.

OK I got it .. The solution is to add Out-String
Send-MailMessage -From "[email protected]" -To "[email protected]" -Subject "Test email"
-Body (Get-ExchangeServer | Out-String) -SmtpServer "mail01.xxx.xx"

Similar Messages

  • Acer crystal Eye webcam not working with websites like facebook and youtube.

    my webcam works just not with websites like facebook or youtube. it used to work before the latest version of adobe flash player came out. Can anyone help me with this?
    Acer Aspirec 7736Z-4809
    Windows 7 Home Premium-64 bit

    fixed it. i forgot i had cyberlink youcam installed. so i uninstalled it and it works fine with faceebook and youtube now.

  • Breakpoints not working with Command Line Project

    I have created a “Command Line Utility” “C++ Tool” and I am unable to breakpoint into the code. I’m in the Debug environment and select “Debug Executable” but no luck. I created the sample tutorial which is a Coco Hello World example and was able to get breakpoints to work there. I downloaded and installed XCode yesterday. Been trying to get breakpoints to work every since with no luck. Thanks in advance.
    Sean
    MBP   Mac OS X (10.4.9)  

    OK, the plot thickens a little. I was being too aggressive on my breakpoint. If I breakpoint at the first cout then I can breakpoint. The problem is if I break after the cin. Breakpoints after cin won’t execute and if I pause all context is lost – like the stack got corrupted.
    <pre>
    #include <iostream>
    #define ENDFILE "CTRL-D or CTRL-Q then CTRL-D in XCODE"
    int main (int argc, char * const argv[])
    char next;
    // insert code here...
    std::cout << "Hello, World!\n";
    const char NWLN = '\n';
    int charCount;
    int lineCount;
    lineCount = 0;
    std::cout << "Enter a line or press " << ENDFILE << ": ";
    std::cin.get(next);
    while (!std::cin.eof())
    charCount = 0;
    while (next != NWLN)
    std::cout.put(next);
    charCount++;
    std::cin.get(next);
    std::cout.put(NWLN);
    lineCount++;
    std::cout << "Number of characters in line " << lineCount
    << " is " << charCount << std::endl;
    std::cout << "Enter a line or press " << ENDFILE << "; ";
    std::cin.get(next);
    std::cout << std::endl << std::endl << "Number of lines processed is "
    << lineCount << std::endl;
    return 0;
    </pre>
    MBP   Mac OS X (10.4.9)  

  • Netflix not working with Mavericks, just get a black screen.

    I just recently installed Mavericks, netflix worked fine before the system upgrade.  Any help would be appreciated.
    I have uninstalled and reinstalled silverlight.  The plug-in is in my harddrive/library/internet plug-in folder.  Safari sees it in the preference pane.  I have set the safari preference for silverlight to always allow and to run in unsafe mode.  I have unchecked the preference to stop plug ins to save power. 
    Netflix loads, switches to the playback screen.  When I move the mouse I see the play/pause and other associated buttons.  It is showing that the movie is loading to my computer, no playback starts.

    I recently had the "Plug-In Failure" on Netflix after I got a new 2014 15" Macbook Pro Retina.
    My coworker found this fix. The current version of silverlight won't start if the machine is running with the discrete NVIDIA GPU. Some apps need it and using an external monitor will cause it to use the discrete. Turn off all your apps and unplug the external montitor. This should put you back in the integrated Intel GPU. Now try to start a Netflix video, once its running you should be able to plug your external monitor back in and start other apps.
    You can also use this utility http://gfx.io to see which GPU is being used.

  • TS5216 Apple released on 10-2-13 a software update which fixes camera issue not working with third parties; google, skype etc

    I just downloaded and all is back to normal.  Took a while but all is well Hope this helps

    Is anyone having a solution for this????? don't say that to sell the phone or upgrade it to the next version? I want to use this phone as it was a last gift given by one important person in my life and can't throw it away, please give me a solution.

  • Powershell send-mailmessage error - helo command rejected: need fully-qualified

    did you try the From and To email addresses in the format of
    "User01 "
    "User02 "
    Like the examples here?
    https://technet.microsoft.com/en-us/library/hh849925.aspx

    Hello,I need help with sending e-mails via Powershell using SMTP authentication. I've described the problem here on StackOverflow already:
    http://stackoverflow.com/questions/31542444/powershell-send-mailmessage-error-helo-command-rejected-...Re-pasting here: """I've read many sources regarding this issue, but no luck :/I am trying to use Powershell 4.0 (Windows server 2012 R2) to send e-mails via the Send-MailMessage commandlet in this way:PHP$From = "[email protected]"$To = "[email protected]"$Subject = "e-mail odeslany z powershellu :)"$Body = "..."$SMTPServer = "smtp.mydomain.cz"$SMTPPort = "587"$credentials = new-object Management.Automation.PSCredential “[email protected]”, (“xxxpasswordxxx” | ConvertTo-SecureString -AsPlainText -Force)Send-MailMessage -From $From -to $To -Subject $Subject -Body $Body -SmtpServer...
    This topic first appeared in the Spiceworks Community

  • Sharepoint send to button not working with document mode 9

    Hi All,
    We are using document mode 9 for HTML 5 in the master page but the SharePoint send to button is not working with ie 9.
    Can anyone help me to resolve this issue.

    SharePoint 2010 doesn't use HTML 5, so its possible that the browser is running in quirks mode. Try the default compatibility mode and see if that works for you.
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Intermittent problem- send or comment buttons will not work- Reboot only sometimes fixes- does not happen in IE

    Recently I have found that when in FB- the 'send' or 'comment' buttons do NOT work. I have also just found that the X along side a post - to get the dropdown to hide, etc- does not work either.
    I have logged of and back on. I have closed firefox and restarted. I have cleared cache, cookies, etc. and then restarted firefox. Nothing works. It seems like this happened a few times and when I came back to the computer after several hours, it was ok. Most of the time I have to reboot.
    While this is happening, some other functions work fine. For instance, if I click on HOME or PROFILE it works. Only seems to be the 'buttons'.
    What's making me really crazy is that it is intermittent! And when it happens, if I open IE (ugh) it works fine.
    Only fixes found at FB are to clear cache, cookies, etc. which I have already stated do nothing at all. Any ideas?

    Do you have that problem when running in the Firefox SafeMode? <br />
    [http://support.mozilla.com/en-US/kb/Safe+Mode] <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    If not, see this: <br />
    [http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]

  • Send & Recieve functionality not working with  WebDav after installing Acrobat XI

    Send & Recieve functionality not working with  WebDav after installing Acrobat XI for PDF.  Acrobat XI is complete installations(Trial Version).

    Hi Kiro ,
    Did you try opening that file in any other browser ?If not ,please try doing that once and see if that  works for you.
    Try Repairing Acrobat once and see if  that helps.
    Launch Acrobat>Navigate to Help>Repair Acrobat Installation.
    Regards
    Sukrit Dhingra

  • HTMLDB_MAIL.SEND does not work with 11g

    Hi Guys,
    I have a simple application that uses HTMLDB_MAIL.SEND. I am running APEX 3.0 against an 11g database. When run against a 10g DB all is good. But with 11g I get
    ORA-24247: network access denied by access control list (ACL)
    I looked up the error which recommends altering ACL stuff, which I know nothing about. Is there a simple way to get rid of this error.
    O.

    Hi,
    I have the same problem as you.
    Colud you please explain me how did you resolve it.
    Thanks
    HTMLDB_MAIL.SEND does not work with 11g

  • Send icon on touchcsreen mostly not working in facebook messenger unless I turn off iphone 5s on and off again, very annoying having to do it after every message!

    send icon on touchcsreen mostly not working in facebook messenger unless I turn off iphone 5s on and off again, very annoying having to do it after every message!

    YYour annoyed at Facebook right since you're using their messenger app. Ask Facebook or look at their support site.

  • TS1702 My "send" button for iMessage is not working. Anyone else having this oproblem?

    My "send" button for iMessage is not working. Anyone else having this problem?

    Mine isn't working either for my iPhone. I tried activating it again and it won't wont let me select my number for iMessage:/ it only lets me add an email address which is pointless seeing as I use I message to txt from my number.

  • Firefox for aol dose not work with aol emails.Why

    Since the email inter face changed I can no longer send email attachments, even items embeded in the email body come out blank at the other end. I use Firefox configured for AOL but that dose not make any difference. I had no problems untill this change is there anyway to reset it. AOL say the problem must be with your software. They sujested that I try using IE 9, I would rather stay with Firefox as I find it is a much better browser.

    ''ralphieboy [[#question-1022015|said]]''
    <blockquote>
    for some reason firefox does not work with the new Email window on yahoo.com All the other browsers work with yahoo mail just fine!! Are you working on a fix???
    </blockquote>
    I have had the problem of Yahoo! mail freezing (my computer freezing) with Firefox right after I boot up my computer and sign into my Yahoo! mail account. I have to either shut down my computer or use Control + Alt and press Delete to eventually bring up the Task Manager option. Then, once the choice for Task Manager comes up, I can click on cancel and Yahoo! mail and my computer have "un-frozen." I have followed all the recommendations for updating Firefox, clearing caches, checking if an Add-On is the problem, etc., as well as all the recommendations on Yahoo! help pages. Nothing has improved the situation to date. Firefox info says the problem is with Yahoo! Yahoo! says it is a browser problem. I just want the problem to be fixed.

  • Caller ID not working with Nokia 6600?

    I have a T-Mobile (US) Nokia 6600, and I can't seem to get address book to display incoming SMS or the caller ID of incoming calls. I've successfully paired the phone via bluetooth, and I can make address book dial the phone and send an sms. I can sync via iSync, use my phone as a modem, etc. etc.
    But regardless of what settings I tweak, I can't seem to get Address Book to show a bezel of any kind on incoming calls - not even an 'Unknown Caller' message! Am I missing something obvious? Third party apps like BluePhoneElite work just fine, so I'm pretty sure it's something wrong with Address Book...
    15" Aluminum Powerbook 1.5 GHz   Mac OS X (10.4.5)  

     
    mdcdsc wrote:
    My caller ID does not work with the new ap either.  I don't like the new ap at all.  The old one was beautiful.  Now my email is very hard to see, so much that I will just use the Apple email that comes with my IPOD.  The caller ID was my favorite thing with the old ap.  and now it doesn't work.  I have followed the instructions and turned everything on, but it just does not work.
    The Caller ID issue was due to an outage. It should be resolved anytime soon. Can yu log out and log back in. Go to app settings and in notifications and turn CAller ID off and on.
    On email - what do you mean 'email is very hard to see' ? I would like to pass on this feedback to the team.

  • HP AiO on iOS7 document capture not working with iPad2?

    Has anyone else found that the Document Capture does not work with the latest version of HP AiO Remote on iOS7? The app grumbles about "The document capture feature is only available if the camera on your iPad is over 5 megapixels" - any solutions to this problem as we have about 95 iPads out in the business that need to use this function regularly

    Hi VijayJois,
    I understand that you are getting an error message when trying to use the capture feature in HP's AiO Remote app.
    The capture feature in the most recent version of the app will give the error message that you are seeing.  A work around to this is to take a photo instead of using capture.  The photo is now available in the AiO app in your camera roll to send to the printer, or send via email. 
    Regards,
    Happytohelp01
    Please click on the Thumbs Up on the right to say “Thanks” for helping!
    Please click “Accept as Solution ” on the post that solves your issue to help others find the solution.
    I work on behalf of HP

Maybe you are looking for

  • Multiple failures after 2 HD changes

    I bought an used Macbook about 2 months ago. The very next morning after I loaded all of my files into it, it crashed and I couldn't restart. I kept getting the little file icon with a question mark, which I later learned means that the startup disk

  • Calling a web service from abap

    Hi all, I want to call a webservice from ABAP. In my report i use the below code . web_rul =' http://test.asmx'. CALL METHOD CL_HTTP_CLIENT=>CREATE_BY_URL          EXPORTING          URL                = WEB_URL          IMPORTING          CLIENT    

  • Can I globally change the itunes folder names

    Due to some complicated circumstances regarding setting up a new laptop and copying my iTines media files across, I have created the following situation: 1. All files are under a folder called iTunes/iTunes Media in their appropriate folders e.g. iTu

  • Why do we have to install a certificate, put a pin in the lockscreen?

    I tried to install a certificate, but are asked to put a PIN, leave the place the PIN you can enable the sliding mode lockscreen! In GB, this process was very simple, and does not alter the method of lockscreen. How to activate the certificate withou

  • Sharing broadband with my old imac

    Hi I have an emac running tiger and a very old imac, the first model, currently running 8.6. I bought a wireless ethernet bridge to share broadband and configured everything with the internet setup assistant. This ran beautifully for a day, with IE b