It’s on the tip of my tongue.
Example: “Replacing the hard drive of this computer would be [idiom]. It’s going to fail completely soon enough.”
[Read, comment, and vote on my answer at Stack Exchange]
“Grasping at straws” is probably the best I can think of but I think it is a weak phrase.
- A fool’s errand
- Herding cats
- A Sisyphean task
- A Pyrrhic victory (if you accomplish the immediate task)
- To win the battle but lose the war
- Tilting at windmills, or battling windmills
- Banging your head on the wall
- Bailing out a barge with a bucket
- Biting off more than you can chew (more about the aptitude of the actor than the futility of the task)