Stop Hard drives going to to sleep - Hard Drive settings

Hello
I wish to stop a USB external hard drive from going to sleep. I read that the it could be done in the Disk management tool but the Drive Settings is greyed out. Does anyone know if there is a solution that can stop hard drives spinning when on battery but not when connected to the mains?
Thanks