自动发送“欢迎”电子邮件给所有新的用户帐户

我有Windows Server 2008 R2企业版x64上的Exchange Server 2010企业版。我的问题;

我正在尝试在http://www.ucblogs.net/blogs/exchange/archive/2010/03/23/Automatically-sending-a-_2700_Welcome_2700_-email-to-all-new-user-accounts上进行设置。 aspx它不起作用。另外,在使用powershell脚本时,它给了我以下结果

(New-ReceiveConnector -Name "Internal Relay" -Bindings 0.0.0.0:25 -RemoteIPRanges 127.0.0.1 -AuthMechanism None -Enabled $true -Fqdn "myserver.mydomain.com" -PermissionGroups AnonymousUsers -Server mysever | Add-ADPermission -User "NT AUTHORITY\ANONYMOUS LOGON" -ExtendedRights "ms-Exch-SMTP-Accept-Any-Recipient") Identity User Deny Inherited AAAa\bbb NT AUTHORITY\ANON... False False 

在上面的命令中,“扩展权限”没有任何信息。

有什么build议么?

 $strScriptName = $MyInvocation.MyCommand.Name if (!(Get-ItemProperty HKLM:\Software\Innervation\$strScriptName -Name LastRun -EA SilentlyContinue)){ # this is the first time the script has run - let's create the registry key and value for future runs New-Item -path HKLM:\Software\Innervation -EA SilentlyContinue | Out-Null New-Item -path HKLM:\Software\Innervation\$strScriptName | Out-Null New-ItemProperty -path HKLM:\Software\Innervation\$strScriptName -Name "LastRun" -Value (Get-Date) -propertyType String | Out-Null write-host "Initial configuration completed." -ForegroundColor green } # get time stamp from registry so we know when it last ran $LastRun = Get-Date ((Get-ItemProperty -path HKLM:\Software\Innervation\$strScriptName -Name LastRun).LastRun) $ElapsedTime = ((Get-Date) - $lastrun).TotalSeconds $MBXArray = @(Get-Mailbox -ResultSize Unlimited | ? {($_.WhenCreated -gt (Get-Date).AddSeconds(-$ElapsedTime)) -and ($_.ExchangeUserAccountControl -ne "AccountDisabled")}) ForEach ($mailbox in $MBXArray ) { $strMsgTo = $mailbox.PrimarySMTPAddress $strMsgBody = "Hello, "+$mailbox.DisplayName+", and welcome to the Contoso family! Please keep this email for future use. It contains vital information. $SMTPClient.Send($strMsgFrom,$strMsgTo,$strMsgTitle,$strMsgBody) } # update registry here with a fresh time stamp Set-ItemProperty HKLM:\Software\Innervation\$strScriptName -Name "LastRun" -Value (Get-Date) | Out-Null 

以上powershell命令不适用于安装了Exchange Server 2010企业版的系统。 工作后,它给了我以下错误。

 HKLM:\Software\Innervation registry key not valid. 

如何使Exchange Server 2010与PowerShell命令兼容?

干杯,

希望能尽快看到您的专家意见。 提前致谢。

干杯。

我正在利用Exchange 2010的这个脚本,但我不得不做一些小的tweeks。 另外请确保您从一个cass服务器运行此服务首先更改PSSnapin以加载Exchange 2010模块。

 “ if (-not((Get-PSSnapin) -match "Microsoft.Exchange.Management.PowerShell.E2010")){ Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 } ” Next, edit the $SMTPClient to match this line- “ $SMTPClient = New-Object Net.Mail.SmtpClient("127.0.0.1") “ 

在定制脚本之后,运行命令的这一部分来创build一个registry项。

 ##########################BEGIN#################### $strScriptName = $MyInvocation.MyCommand.Name if (!(Get-ItemProperty HKLM:\Software\Innervation\$strScriptName -Name LastRun -EA SilentlyContinue)){ # this is the first time the script has run - let's create the registry key and value for future runs New-Item -path HKLM:\Software\Innervation -EA SilentlyContinue | Out-Null New-Item -path HKLM:\Software\Innervation\$strScriptName | Out-Null New-ItemProperty -path HKLM:\Software\Innervation\$strScriptName -Name "LastRun" -Value (Get-Date) -propertyType String | Out-Null write-host "Initial configuration completed." -ForegroundColor green } # get time stamp from registry so we know when it last ran $LastRun = Get-Date ((Get-ItemProperty -path HKLM:\Software\Innervation\$strScriptName -Name LastRun).LastRun) $ElapsedTime = ((Get-Date) - $lastrun).TotalSeconds ######################END#################################### 

然后注释掉最后一行来进行testing。

 #########################BEGIN############################### Set-ItemProperty HKLM:\Software\Innervation\$strScriptName -Name "LastRun" -Value (Get-Date) | Out-Null ######################END####################### 

创build一个新的用户帐户,并testing你的脚本,直到你开心。 按照预期工作后,删除评论。

@Toshana