RSS

powershell V2 发邮件

29 Nov

powershell v1的时候,咱要发个邮件还挺麻烦的。升级到V2后,新脚本send-mailmessgae简化了这个步骤。

别以为exchange 2007没法使用V2哦!exchange 2007支持powershell v2的,只是新功能,比如远程连接这些无法使用而已。Powershell V2的原生命令都是支持的。

Send-MailMessage –From xunyang@contoso.ad –To xunyang@contoso.ad –Subject “Test Email” –Body “Testing the cmdlet” –SmtpServer xunyang.contoso.ad

 

send-mailmessage -from "User02 <user02@example.com>" -to "User01 <user01@example.com>" -subject "Test mail"

send-mailmessage -from "User01 <user01@example.com>" -to "User02 <user02@example.com>", "User03 <user03@example.com>" -subject "Sending the Attachment" -body "Forgot to send the attachment. Sending now." -Attachments "data.csv" -priority High -dno onSuccess, onFailure -smtpServer smtp.fabrikam.com

send-mailmessage -from "ITGroup <itdept@example.com>"-to "User01 <user01@example.com>" -cc "User02 <user02@example.com>" -bcc "ITMgr <itmgr@example.com>" -subject "Don’t forget today’s meeting!" -credential domain01\admin01 -useSSL

更多了解请点这儿

Send-MailMessage

Advertisements
 
1 Comment

Posted by on November 29, 2009 in Powershell

 

One response to “powershell V2 发邮件

  1. zheng

    April 29, 2010 at 11:48

    Powershell的版本是和.NetFramework一致的?是吗?,win2003Server默认安装的.NetFramework好像是1.1的,要升级才能允许,真是麻烦啊。

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: