Powershell download of file from HPSM

I'm stumbling through working with powershell (for the first time) and accessing HPSM (for the first time).  My current goal is to be able to download an attachment from a HPSM ticket.  I have working code that can get the details for a HPSM ticket, including the attachment's CID, length, name, and content type.  But I haven't been able to figure out how to pull the actual data from the attachment once I know these details.

Would anyone be willing to share a description and code that could help with this endeavor?