Shutdown Script Not Working Solved

  1.    #1

    Shutdown Script Not Working


    Hi,

    Following this article How to empty the Windows Recycle Bin automatically - gHacks Tech News

    I created the batch script, which works, and added to Shutdown scripts via GPE.

    But, it does not run at shutdown.

    I have 2 accounts and 2 drives on the laptop, Local Admin and Local Standard (which uses D drive for daily usage); could it be I need to add something to the script to specify which drive and which account to use?

    Thanks in advance.
      My ComputerSystem Spec

  2.    #2

    Although the Ghacks article doesn't mention it specifically, have you put the script in C:\WINDOWS\System32\GroupPolicy\Machine\Scripts\Shutdown ? The other thing you can try according to this thread is disable faststartup ?

    Shutdown script (gpedit) runs with 'Restart' but not with 'Shut down' Solved - Windows 10 Forums
      My ComputerSystem Spec

  3.    #3

    Hi das10,

    Well, after some frustrating testing this is the outcome:

    1. disabling fast startup made no difference

    2. putting the script where you suggested had no effect

    3. creating a task in Task Scheduler to run at startup asked me to enter credentials but even using Local Admin it gave an error (not recognized, not authenticated etc.)

    By the way, why does Task Scheduler not have an option to run at shutdown???

    In the end, I put the script in the startup folder for the local standard account and that worked.

    Solved?

    Not exactly because I would like to understand why using GPE did not run the script or why the other options also did not work.

    In any event, really appreciate the help.

    Regards.

    Update: I found the solution, at least on my laptop with the current configurations.

    Adding the script to Group Policy >> Computer Configuration > Windows Settings > Scripts > Shutdown does not work, as reported above.

    However, adding to Group Policy >> User Configuration > Windows Settings > Scripts > Logoff works exactly as I wanted.
    Last edited by Rubi; 6 Days Ago at 13:04. Reason: adding more information
      My ComputerSystem Spec

  4.    #4

    OK, so I just tried this using the empty recycle bin from the Tenforums tutorial section. But first, I added a simple "ping -n 5 -w 0.5 127.0.0.1" command to the batch file to make the script window last longer after I edited Group Policy to show the script as it it runs by enabling it at (computer configuration -> adminstrative templates -> system -> scripts). The error message indicated that running scripts on this machine is not allowed (probably because the batch command is invoking powershell to execute the empty recycle bin command). This could be overcome, by allowing scripts to run, but I didn't venture into that territory due to any possible security issues in future. I don't know if this is the definitive answer as to why the bat file won't run in shutdown scripts.
      My ComputerSystem Spec

  5.    #5

    That's very interesting indeed.

    So, if it works under User Configuration as posted above then presumably it has something to do with privileges (as you discovered) and as I noticed in a roundabout kind of way.

    Appreciate that you looked into it further.

    Are there any potential security issues I need to be concerned about with the way I set it up now?
      My ComputerSystem Spec

  6.    #6

    I personally don't think so unless you have changed the default settings ( which I don't think you have ) and enabled scripts to run system wide without restriction.
    Last edited by das10; 6 Days Ago at 17:33.
      My ComputerSystem Spec


 

Related Threads
It seems group policies under Local Group Policy Editor>Computer configuration>Administrative Templates>System>Scripts are not working in Windows 10 version 1809. Back in 1803 they worked perfectly fine. I can confirm that they can be set and the...
can anyone tell me why this script fails with rc=5.. I am not very well versedin resolving scripts.... MUCH APPRECIATED IN ADVANCE! Const JOIN_DOMAIN = 1 Const ACCT_CREATE = 2 Const ACCT_DELETE = 4 Const WIN9X_UPGRADE = 16 Const...
I am using Windows 10 Home on a HP i3 laptop. Just recently I have started receiving an error pop-up which says "Windows Script Host - There is no script engine for file extension ".js"". There doesn't seem to be a pattern to when the error...
how to get rid of script error pop ups in BSOD Crashes and Debugging
how can I get rid of script error pop ups?
Sub-script and Super-script in General Support
Is it possible to use sub-script and super-script when typing emails with Windows 10? I was able to do this when using Windows 7 and typing documents but not for emails. I was expecting that with the major up-grade to from 7 to 10 it would now be...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 01:35.
Find Us