###
#
# Exprot attachments from Outlook folder on your local computer.
#
###


$filepath = "c:\pdf"
Remove-Item -path $filepath -Recurse

If (-not (test-path $filepath) ) {new-item -type [Directory] -path $filepath}
Else {write-host -ForegroundColor red "$filepath exist"}
Function Get-OutlookInBox 
{ 

 Add-type -assembly "Microsoft.Office.Interop.Outlook" | out-null 
 $outlook = new-object -comobject outlook.application 
 $namespace = $outlook.GetNameSpace("MAPI")
 $folder = $namespace.PickFolder()


 $folder.items |  foreach {
 $SendName = $_.SenderName
    $_.attachments|foreach {
    Write-Host $_.filename
    $a = $_.filename
    If ($a.Contains("pdf")) {
    $_.saveasfile((Join-Path $filepath "$a"))
# Uncomment the lines below if you want to pull multiple types of attachments out of Outlook.
    #}
    #If ($a.Contains("xlsx")) {
    #$_.saveasfile((Join-Path $filepath "$a"))
    #}
    #If ($a.Contains("docx")) {
    #$_.saveasfile((Join-Path $filepath "$a"))
       }
  }
} 
   
 ##Select-Object -Property Subject, ReceivedTime, Importance, SenderName 

} #end function Get-OutlookInbox


#Get-OutlookInBox | where {$_.SenderName -like '*'}

Get-OutlookInBox

Notes