728x90
반응형
Exchange 서버를 운용하다보면 특정기간의 메일을 추출해야할때가 한번쯤 생긴다..
그 한번쯤을 위해 기록을 남깁니다.
#PST를 추출하기 위한 위치 지정
$exportPath = "\\ExServer\test"
#추출대상
$users = Get-Mailbox -ResultSize unlimited -RecipientTypeDetails UserMailbox
#시작 기간과 종료 기간
$startDate = (Get-Date "2025-03-17 00:00:00").Tostring("MM/dd/yyyy")
$endDate = (Get-Date "2025-03-23 00:00:00").Tostring("MM/dd/yyyy")
#사용자 alias를 사용하여 파일명 생성
foreach ($User in $Users) {
$userName = $user.Alias
$pstPath = "$exportPath\$userName.pst"
#메일 PST Export 명령어로 특정기간과 특정 폴더만 추출
New-MailboxExportRequest -Mailbox $userName -FilePath $pstPath -ContentFilter "Received -gt '$startDate' -and Received -lt '$endDate'" -IncludeFolders "Inbox", "Sent Items", "받은 편지함", "보낸 편지함"
}
728x90
반응형
'Product > Microsoft Product' 카테고리의 다른 글
Microsoft Intune (0) | 2025.03.15 |
---|---|
Windows 작업 스케줄러에서 User_Feed_Synchronization 스케줄 삭제하기 (0) | 2025.03.10 |
Exchange - Remove Proxy Address from Mailbox User (0) | 2025.03.10 |
AWS EC2 Windows 2025 생성 후 이슈 (0) | 2025.03.10 |
Microsoft 365 및 클라우드 서비스 PowerShell 연결 방법 총정리 (0) | 2025.03.10 |