Enviando automaticamente um e-mail de boas-vindas para todas as novas contas de usuário

5

Eu tenho um Exchange Server 2010 Enterprise Edition no servidor Windows 2008 R2 Enterprise Edition x64.Minha pergunta;

Estou tentando fazer configurações em link isso não funciona.adicionalmente, me dá o seguinte resultado ao trabalhar script 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

No comando acima, "Direitos estendidos" sem informações.

Alguma sugestão?

$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

O comando acima do powershell não funciona no sistema que instalou o Exchange Server 2010 Enterprise Edition. Depois de funcionar, isso me dá o seguinte erro.

HKLM:\Software\Innervation   registry key not valid.   

Como faço para tornar compatível com o Exchange Server 2010 esse Comando do PowerShell?

Felicidades,

Espero que seu especialista avise em breve. Agradecemos antecipadamente.

Felicidades.

    
por Cell-o 11.07.2010 / 17:38

1 resposta

1

Estou usando esse script com o Exchange 2010, mas tive que fazer algumas pequenas novidades. Também certifique-se de que você está executando isso de um dos servidores de cass Primeiro, altere o PSSnapin para carregar o módulo do 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")  “

Depois de ter o script personalizado, execute esta seção do comando para criar uma chave reg.

##########################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####################################

Em seguida, comente a última linha para fins de teste.

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

Crie uma nova conta de usuário e teste seu roteiro até ficar feliz. Depois que ele funcionar como planejado, remova o comentário.

@Toshana

    
por 06.08.2010 / 04:26