Adding Attachments to a Specific Item in SharePoint

This is a major thing which is used in our day to day activities but also in our major Migration projects in which we need to move Dot Net applications to SharePoint.
 
Here is a PowerShell which will do that easily for you, Change the following details down in the script.
 
Open SharePoint 2010 Management Shell by going to Start >> All Programs >>SharePoint >>Microsoft SharePoint 2010 Products >> SharePoint 2010 Management Shell (Run as Administrator).
 
Run the following script.  
  1. [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")  
  2.  function AddAttachment($item, $filePath)  
  3.  {  
  4.  $bytes = [System.IO.File]::ReadAllBytes($filePath)  
  5.  $item.Attachments.Add([System.IO.Path]::GetFileName($filePath),$bytes)  
  6.  $item.Update()  
  7.  }  
  8.    
  9.  $site = [Microsoft.SharePoint.SPSite]("Your site name")  
  10.  $web = $site.OpenWeb()  
  11.  $list = $web.Lists["Your List name"]  
  12.  $item = $list.GetItemById(Your Id)  
  13.  AddAttachment $item "Your Document Name"