Only add command on platforms where it can be run

Closes #3561