0

In gpedit.msc under Computer config -> Windows settings -> Scripts -> Shutdown I added my .bat file to execute it each time when shutting down the PC, but I would get error access denied. It's a taskkill command to kill certain task. It gives same error if you execute it with mouse left-click, but works if you execute it inside cmd prompt opened as administrator.

How do I execute this under administrator privileges?

Script: taskkill /f /im googledrivesync.exe I'm working on this workaround, it's a known bug for Google Drive not quitting on system shut down.

3
  • 1
    Use Task scheduler. You can then make it run with highest privileges, or use NTAUTHORITY\SYSTEM as user
    – LPChip
    Oct 28, 2017 at 13:33
  • @LPChip There is no event on task scheduler as Shut down or system log off or any similar I can't find. Oct 28, 2017 at 15:55
  • In your .bat script, use something like SCHTASKS /RUN /TN "KillGoogledrivesync" where KillGoogledrivesync is a task to run taskkill /f /im googledrivesync.exe in task scheduler. Should be defined to run as user SYSTEM with the highest privileges. Enable running on demand, do not trigger on any event or time.
    – JosefZ
    Oct 28, 2017 at 17:46

0

You must log in to answer this question.

Browse other questions tagged .