A method for treating an infection using irreversible electroporation is presented. The method includes providing an ablation device that has at least one electrode and inserting the ablation device into a target tissue of a patient. The tissue at least partially surrounds the implanted medical device. The outer surface of the medical device is at least partially covered by infectious cells. The method also involves positioning at least one electrode in or near the implanted medical device and delivering electrical pulses to or near the implanted medical device sufficient to irreversibly electroporate the infectious cells.