Can you connect to the board via USB terminal and send the same commands?
Does it give an M122 report?
What firmware version are you running?
Which Duet board?

Try working through this guide and see what you find works and doesn't work.

https://docs.duet3d.com/en/User_manual/Troubleshooting/Duet_wont_respond