Every hacking target (doors, objectives, mechanical units, Advent security towers) offers you a choice of rewards, one easy to get and one difficult. The hacking stat of your Specialist versus the target's hack defence will determine the chance of success so obviously you'll want to boost your hacking as much as possible. The biggest improvements will come from increased rank but researching improvements to your GREMLINs* will also be a big help.
*Mark II upgrades require researching the Advent MEC Breakdown; Mark III upgrades require researching the Sectopod Breakdown.
Assuming you're attempting to hack a mechanical unit, it's also possible to shoot it with Bluescreen rounds first as these will reduce the hack defence on a successful hit.
Alternatively, if you own the "Shen's Last Gift" DLC pack it's possible to get this done much easier, and certainly much earlier it could be completed in your campaign otherwise.
During the "Lost Tower" mission, Lily Shen will be part of your ground team and if you attempt it as soon as it's available in your campaign she will be significantly better than any other Specialist you have available (she's the equivalent of a Colonel with both perk trees unlocked). Simply use her for all hacking opportunities (the elevator console in the first segment is ideal), and she should be able to get the better reward with ease.
While on this mission it is also possible to get the following achievements the same relative ease: