foreach ($attachment in $Files)
         {
           Try {
                   $fs = [IO.File]::OpenWrite(($AttachmentPath + $attachment.DisplayName))
                  $memoryStream = New-Object IO.MemoryStream
                  $buffer = New-Object byte[] 8192
                  [int]$bytesRead|Out-Null
                  while (($bytesRead = $attachment.Content.Read($buffer, 0, $buffer.Length)) -gt 0)
                     {
                        $memoryStream.Write($buffer, 0, $bytesRead) 
                     }        
                  $memoryStream.WriteTo($fs)  
                     }
            Finally
               {
                $fs.Close()
                $memoryStream.Close()
                write-host "Dowloaded: $attachment.name"
               }
         } #End of ForEach
   } #End of IF