본문 바로가기
Product/Microsoft Product

Exchange server 특정기간동안 PST 메일 추출

by Kaga 2025. 3. 25.
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
반응형