A 63-year-old Moray farmer has been ordered to carry out unpaid work after inspectors found emaciated cattle on his farm.