Execute bat file before Shutdown on Windows10 : Does not work

0

I am new on this platform, I hope I respect the global behaviour ! :)

My Problem :

On Windows 10, at every shutdown, I want to execute a bat file that shuts down linux machine threw ssh connection.

I tried two scenarios :

  • Scenario 1 : Thanks to a scheduled task :

Type : On Event (Basic) Log : System Source : User32 EventID : 1074 That option gives me an error on the Last Run Result : 0xC0000142 I tried to use different privileges, different accounts, using also run whether user is logged on or not.

  • Scenario 2 : Threw Group Policy Editor :

I have added my bat file to be runned at shutdown into the GPE shutdown properties script. Doing this, when I shut down the system gets stuck on the shutdown screen. I need to reboot hard the machine.

My .bat file works perfectly by itself when I double Click on it, and does the work, and close perfectly.

So I am quiet stuck ! Could anyone help me with what I am doing ?

Thank you very much !!

PS : Here is my .bat file that works good when we double click on it, but that doesn't execute properly on shutdown :

@echo off

cls

echo shutdown LVU .....

START CMD.EXE /C "ssh -oStrictHostKeyChecking=no -t atxvision1@192.168.0.1 "sudo shutdown now""

START CMD.EXE /C "ssh -oStrictHostKeyChecking=no -t atxvision1@192.168.0.2 "sudo shutdown now""

START CMD.EXE /C "ssh -oStrictHostKeyChecking=no -t atxvision1@192.168.0.3 "sudo shutdown now""

START CMD.EXE /C "ssh -oStrictHostKeyChecking=no -t atxvision1@192.168.0.4 "sudo shutdown now""

exit
windows
ssh
scheduled-tasks
shutdown
group-policy
asked on Stack Overflow Mar 4, 2021 by Frozenstudent • edited Mar 11, 2021 by spacemonki

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0