Cel*_*l-o 5 powershell exchange-2010
我在 Windows server 2008 R2 Enterprise Edition x64 上有一个 Exchange Server 2010 Enterprise Edition。我的问题;
我正在尝试在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
Run Code Online (Sandbox Code Playgroud)
在上面的命令中,“Extended Rights”没有信息。
有什么建议?
$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
Run Code Online (Sandbox Code Playgroud)
以上 powershell 命令在安装了 Exchange Server 2010 企业版的系统上不起作用。它工作后,它给了我以下错误。
HKLM:\Software\Innervation registry key not valid.
Run Code Online (Sandbox Code Playgroud)
如何使此 PowerShell 命令与 Exchange Server 2010 兼容?
干杯,
希望尽快看到您的专家建议。提前致谢。
干杯。
小智 1
我\xe2\x80\x99m 在 Exchange 2010 中使用此脚本,但我必须进行一些小的调整。另请确保从其中一台 cas 服务器运行此命令\n首先更改 PSSnapin 以加载 Exchange 2010 模块。
\n\n\xe2\x80\x9c if (-not((Get-PSSnapin) -match "Microsoft.Exchange.Management.PowerShell.E2010")){ Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 } \xe2\x80\x9d\nNext, edit the $SMTPClient to match this line- \xe2\x80\x9c $SMTPClient = New-Object Net.Mail.SmtpClient("127.0.0.1") \xe2\x80\x9c\nRun Code Online (Sandbox Code Playgroud)\n\n自定义脚本后,运行此部分命令来创建注册表项。
\n\n##########################BEGIN####################\n$strScriptName = $MyInvocation.MyCommand.Name\nif (!(Get-ItemProperty HKLM:\\Software\\Innervation\\$strScriptName -Name LastRun -EA SilentlyContinue)){\n # this is the first time the script has run - let\'s create the registry key and value for future runs\n New-Item -path HKLM:\\Software\\Innervation -EA SilentlyContinue | Out-Null\n New-Item -path HKLM:\\Software\\Innervation\\$strScriptName | Out-Null\n New-ItemProperty -path HKLM:\\Software\\Innervation\\$strScriptName -Name "LastRun" -Value (Get-Date) -propertyType String | Out-Null\n write-host "Initial configuration completed." -ForegroundColor green\n}\n# get time stamp from registry so we know when it last ran\n$LastRun = Get-Date ((Get-ItemProperty -path HKLM:\\Software\\Innervation\\$strScriptName -Name LastRun).LastRun)\n$ElapsedTime = ((Get-Date) - $lastrun).TotalSeconds\n######################END####################################\nRun Code Online (Sandbox Code Playgroud)\n\n然后注释掉最后一行以进行测试。
\n\n#########################BEGIN###############################\nSet-ItemProperty HKLM:\\Software\\Innervation\\$strScriptName -Name "LastRun" -Value (Get-Date) | Out-Null\n######################END#######################\nRun Code Online (Sandbox Code Playgroud)\n\n创建一个新的用户帐户并测试您的脚本,直到您满意为止。当它按预期工作后,删除评论。
\n\n@托莎娜
\n| 归档时间: |
|
| 查看次数: |
2977 次 |
| 最近记录: |