Exchange 용 powershell 스크립트를 작성하여 특정 사서함이 1 개월 내에받은 전자 메일의 양을 찾아 해당 개체 합계를 특정 개인에게 전자 메일로 보내려합니다. 지금까지 내가 가진했습니다Exchange 자동화 스크립트
$date = Get-Date -Format MM/dd/yyyy
$time = Get-Date -Format HH:mm:ss
$previousMonth =
PS C:\> Get-MessageTrackingLog -Recipients:mailbox1.org -start "02/01/2017 00:00:00" -end "$date $time" -EventId "Receive" -ResultSize unlimited | Measure-Object
PS C:\> Get-MessageTrackingLog -Recipients:mailbox2.org -start "02/01/2017 00:00:00" -end "$date $time" -EventId "Receive" -ResultSize unlimited | Measure-Object
PS C:\> Get-MessageTrackingLog -Recipients:mailbox3.org -start "02/01/2017 00:00:00" -end "$date $time" -EventId "Receive" -ResultSize unlimited | Measure-Object
PS C:\> Get-MessageTrackingLog -Recipients:mailbox4.org -start "02/01/2017 00:00:00" -end "$date $time" -EventId "Receive" -ResultSize unlimited | Measure-Object
ps c:\> Send-MailMessage -SmtpServer "server" -To "recipient email<recipient email>" -From "Monthly Mailbox Totals <email address>" -Subject "Monthly Mailbox Item Count" -Body ""
는 내가에 문제가 있어요 이것이다 : 나는 꽤 -start 입력 이전 달의 1을 얻을 수 날짜 범위를 계산하는 방법을 알아낼 수 없습니다 현재 날짜와 시간에서부터 시작하여 두 번째로 합계를이 형식의 전자 메일 본문으로 보내는 방법에 대해 고민하고 있습니다. 이 스크립트가 도움이된다면 매달 첫 번째 스크립트를 실행하고 싶습니다.
어떤 조언을 미리 주시면 감사하겠습니다.
로 날짜 열을 변환 유형 가속기를 사용할 수 있습니다. 자신을 단 한 명으로 제한해야합니다. 과거에 날짜를 얻고 현재의 서식 논리를 유지하는 데 사용할 수있는 날짜 방법이 있습니다. 추적 로그 요청의 결과도 저장하지 않습니다. 이것을 자동화하는 방법을 묻고 있습니까? – Matt