I was able to find this script below. As I want to run the script via a workflow and that it would be triggered when a new item is added to the list.
right now the powershell script is dependant on knowing the ID #
I'm giving credit to
Eli Van Eenwyk [MCM]as it is his script
[void][reflection.assembly]::Loadwithpartialname("microsoft.sharepoint")
$webUrl = "<your weburl>" # the url to the site that has the list
$library = "<your library name>" # Library Name
$tempLocation = "C:\Temp\" # Path to dump files
$itemId = 1 #I need this be equal to the Current item ID # Item Id to read attachments from
# Load the Site / Web
$s = new-object Microsoft.SharePoint.SPSite($webUrl)
$w = $s.OpenWeb()
# Grab the list and item that you want to download the attachments from
$l = $w.Lists[$library]
$i = $l.GetItemById($itemId)
# Loop thru each attachment
foreach ($attachment in $i.Attachments)
{
# Get the attachment
$file = $w.GetFile($i.Attachments.UrlPrefix + $attachment)
$bytes = $file.OpenBinary()
# Build the destination path
$path = $tempLocation + $attachment
Write "Saving $path"
# Download the file to the path
[System.IO.FileStream] $fs = new-object System.IO.FileStream($path, "OpenOrCreate")
$fs.Write($bytes, 0 , $bytes.Length)
$fs.Close()
}
Anyone have any ideas