2
현재 PST 파일 내 전자 메일에서 첨부 파일 이름을 가져 오려고합니다. Powershell을 통해이 작업을 수행하려고합니다. 내 코드 브래킷은 한 가지를 제외하고는 지금까지 제대로 작동합니다. 첨부 파일 이름으로 System .__ ComObject를 씁니다. 어떤 아이디어? Powershell : PST 파일에서 전자 메일 첨부 파일 받기
## Path where the PSTFiles are
$PSTArr = Get-ChildItem -Path .\ -Recurse
$Attachments = @()
## Processing
ForEach ($PST in $PSTArr) {
if ($PST.Name -like "*.pst") {
[string]$pstPath = $PST.FullName
Write-Output ("Checking File: " + $pstPath)
# Lets see if there is a running outlook process
$oProc = (Get-Process | where { $_.Name -eq "OUTLOOK" })
if ($oProc -eq $null) { Start-Process outlook -WindowStyle Hidden; Start-Sleep -Seconds 5 }
$outlook = New-Object -ComObject Outlook.Application
# Assign namespace
$namespace = $outlook.GetNamespace("MAPI")
# Add PST
$namespace.AddStore($pstPath)
$pstStore = ($nameSpace.Stores | where { $_.FilePath -eq $pstPath })
# Add RootFolder of the PST
$pstRootFolder = $pstStore.GetRootFolder()
# Get attachments of the E-Mails
$Attachments += $pstRootFolder.Items | Select Attachment
# Disconnect PST File
$namespace.GetType().InvokeMember('RemoveStore',[System.Reflection.BindingFlags]::InvokeMethod,$null,$namespace,($pstRootFolder))
}
}
이 시도에 응답/도움을
감사
작품 벌금을! 감사! – MaxM