Is it possible to launch a command line ?
My first guest was to try to replace your keyboard strokes mentioned , by Windows + R (only Windows will not allow to be recorded), then switch to macro record, 's', 'h", etc. For type shutdown -t 300 -s
Are you able to proceed on your side ? There is a better option in GUI ?