Ryder had used a dietary supplement for weight-loss which contained banned substances. The left-hander's suspension was backdated to April 19 and will continue till October 19.
"Mr Ryder was tested at a Ford Trophy Wellington Firebirds game against Northern Knights on 24 March 2013. He returned a positive test for 1-Phenylbutan-2-amine (PBA) and N, alphadiethyl-benzeneethanamine (DEBEA), both of which are banned in competition. The Tribunal provisionally suspended him on 19 April 2013. The hearing took place on 9 August 2013," New Zealand Sports Tribunal said in a statement.
"The mandatory penalty for this violation is two years' suspension. However the suspension can be less if the athlete establishes how the prohibited substances got in his system and that the taking of the prohibited substance was not intended to enhance his sport performance," the statement added.
"Mr Ryder admitted the violation and stated he had been using a dietary supplement in order to lose weight and had taken two capsules five days before being tested."
The 29-year-old Ryder has been in self-imposed exile from international duty since February 2012. In March this year, he was assaulted outside a bar in Christchurch. That attack forced him to miss the Indian Premier League (IPL) where he was signed by Delhi Daredevils.
Ryder has played 18 Tests, 39 One Day Internationals and 20 Twenty20 Internationals.