In conveying the defendant to the Department of Correction, the county sheriff shall have all the powers of preventing an escape, of resisting an effort to rescue the defendant, of recapturing the defendant, and of summoning persons to his or her aid that the county sheriff would have in executing a warrant of arrest in his or her county.