Windows 10: Shutdown script (gpedit) runs with 'Restart' but not with 'Shut down'

Discus and support Shutdown script (gpedit) runs with 'Restart' but not with 'Shut down' in Windows 10 Support to solve the problem; Dear all, I have an issue with a shutdown script that I don't manage to resolve: I wrote a .bat file script that works fine when it is clicked on.... Discussion in 'Windows 10 Support' started by Dirk123, Apr 13, 2016.

  1. Dirk123 Win User

    Shutdown script (gpedit) runs with 'Restart' but not with 'Shut down'


    Dear all,

    I have an issue with a shutdown script that I don't manage to resolve:
    I wrote a .bat file script that works fine when it is clicked on. Through gpedit.msc, I added it as a shutdown script. When the computer is restarted (Power -> Restart), it works fine as well (I log the results of this batch file to a txt file, so I can check it).
    However, when I do a normal shutdown of the computer (Power -> Shut down, so no automatic restart, but manual restart later on), the script is not activated at all (not even the log.txt file is created).
    My OS is Windows 10 Pro.

    Has anyone run into this problem as well?

    Thanks and kind regards,
    Dirk

    :)
     
    Dirk123, Apr 13, 2016
    #1

  2. Windows 10 and Shutdown after Creator's Update

    Hello Community!

    I'm hoping soemone can enlighten me as to what the people of Microsoft have changed about the shutdown process after Creator's Update.

    I still make use of shutdown script heavily to do stuff which needs to happen on a regular basis, and I use them because that is what my customers want - stuff that needs to happen regularly (like installing Windows updates, copying files to network shares
    at the end of the day) needs to happen when it doesn't interfere with my customer's work - and this is precisely when they shut down their computers at the end of the day. And you kow what it's like in the modern world of work, the end of the day can mean
    many things, be it 3PM, 5PM or 7PM, so running a scheduled task at say 7PM is not gonna do it, I need something that automatically happens when a user shuts down their computer, doesn't matter when that is, so shutdown scripts it is.

    Anyway, I'm digressing. I've been making use of shutdown scripts ever since Windows XP, and Windiws 10 has never given me any trouble until the Creator's Update, shutdown scripts ran just like they did on XP or 7.

    With Creator's Update, at first there was a problem described by another user here:

    After installing Creators Update of Windows 10, logoff script can't be run correctly

    Apparently, Microsoft have fixed this issue with a patch, the problem went away with KB4025342 in July 2017, shutdown scripts are once again displayed normally.

    But I'm still facing the issue that apparently MS has changed the way network connections are handled when shutting down a computer. From Windows XP to Windows 10 1493, network connections would have been available during shutdown scripts, which is no longer
    the case in the current build.

    Many of my scripts fail to run properly, and by testing a lot I narrowed it down to a simple issue: Network is shut down by Windows 10
    before shutdown scripts get to run. You can see that for instance by just putting "ipconfig /renew" into a shutdown script and then a pause, and you will see the error message you'll get when your network is disconnected:

    "no operation can be performed on <name of connection> while it has its media disconnected".

    And this for network connections which should clearly be up and were up and running before starting to shut down my computer.

    In a nutshell, my two questions:

    1) Is there any overview somewhere about what exactly Microsoft has changed about the shutdown process in Windows 10 15063 so I can react accordingly?

    2) Is there any way I can reestablish network connections Windows has already shut down, e.g. by some commands I could put in my shutdown scripts? Thanks a lot guys!
     
    Baedamichi, Apr 13, 2016
    #2
  3. After Windows 10 update in last week, when I attempt to shut down, machine shut down but then restarts.

    Running W10 on ASUS with Intel i7 4770 with 16G RAM. Latest recorded update was 07/23/2017

    Running Classic Shell. When select W - shut down, get second "shut down" screen. Then shuts down, but the restarts.

    Does the same if I got into tile "start menu" and select shutdown, also restarts.

    Can shut it down once it restarts by selecting power icon on bottom right if select shut down.

    What changed????
     
    hunterabqJLH, Apr 13, 2016
    #3
  4. Superfly Win User

    Shutdown script (gpedit) runs with 'Restart' but not with 'Shut down'

    Are you sure it's in Shutdown and not Startup? Otherwise perhaps a scheduled task may work better.
     
    Superfly, Apr 13, 2016
    #4
  5. Dirk123 Win User
    Yes, it is in Shutdown.
    I have no scripts in Startup.
     
    Dirk123, Apr 13, 2016
    #5
  6. Superfly Win User
    ... and it's in C:\WINDOWS\System32\GroupPolicy\Machine\Scripts\Shutdown ?
     
    Superfly, Apr 13, 2016
    #6
  7. Dirk123 Win User
    Yes, it is.
    The script is also mentioned in the C:\WINDOWS\System32\GroupPolicy\Machine\Scripts\scripts.ini file.
    The strange thing is that the script runs indeed when I select Power -> Restart, but it doesn't run when I select Power -> Shut down.
     
    Dirk123, Apr 13, 2016
    #7
  8. Superfly Win User

    Shutdown script (gpedit) runs with 'Restart' but not with 'Shut down'

    Hmmm... well can't say for sure except the difference between the two is restart is a full boot and shutdown a hibernate boot - up to you play with powercfg settings maybe...
     
    Superfly, Apr 13, 2016
    #8
  9. Dirk123 Win User
    Thanks, I managed to solve the problem with your suggestion!
    When I disable the fast startup (Power options -> Choose what the power buttons do -> Change settings that are currently unavailable), the shutdown script runs during both Restart and Shutdown. It seems that a full boot is needed to make the shutdown script being activated.
     
    Dirk123, Apr 13, 2016
    #9
  10. Superfly Win User
    Splendid!.. you are welcome.
     
    Superfly, Apr 4, 2018
    #10
Thema:

Shutdown script (gpedit) runs with 'Restart' but not with 'Shut down'

Loading...
  1. Shutdown script (gpedit) runs with 'Restart' but not with 'Shut down' - Similar Threads - Shutdown script gpedit

  2. PC not shutting down but restart

    in Windows 10 Performance & Maintenance
    PC not shutting down but restart: Shutdown button not working. When you click it, the function will be restart. The PC will only restart. Restart button has correct function though. I need help. I dont know this kind of scenario in PC....
  3. Shut down or restart

    in Windows 10 Gaming
    Shut down or restart: Occasionally when I try to shut down or restart after an update I get this message. I tried going to Task Manager and ending process. Doesn't change anything. It doesn't happen all the time. How can I stop it, kinda annoying.Please Adviseleahcimj...
  4. Shut down or restart

    in Windows 10 Software and Apps
    Shut down or restart: Occasionally when I try to shut down or restart after an update I get this message. I tried going to Task Manager and ending process. Doesn't change anything. It doesn't happen all the time. How can I stop it, kinda annoying.Please Adviseleahcimj...
  5. Restart + Shutting down

    in Windows 10 Software and Apps
    Restart + Shutting down: Hey guys, nice to see you. I have problem with windows restart and shut down. Everytime I try to restart or shut down my PC from windows menu it stuck on restarting / shutting down screen.And I need to force restart/shut down from the physical button on the Pc case. I cant go...
  6. Restart + Shutting down

    in Windows 10 Gaming
    Restart + Shutting down: Hey guys, nice to see you. I have problem with windows restart and shut down. Everytime I try to restart or shut down my PC from windows menu it stuck on restarting / shutting down screen.And I need to force restart/shut down from the physical button on the Pc case. I cant go...
  7. Gpedit shutdown scripts on win 10 home?

    in Windows 10 Ask Insider
    Gpedit shutdown scripts on win 10 home?: ok i'm stuck on this problem: i want to run a sample file.bat when my pc shuts down. I have added gpedit.msc on my machine via some batch file and added my .bat script in there. For some reason it won't execute the script when i shutdown my pc. I think is because i have win10...
  8. Issues while running PowerShell Scripts when shutting down the PC

    in Windows 10 Performance & Maintenance
    Issues while running PowerShell Scripts when shutting down the PC: Hi all, I try to run a Powershell Script (*.ps1) when i shut down my PC. I created the script and it is working fine when i run it. However if i want to run it on a regular Shutdown it seems like it does not start or is not finished, before Windows is killing every running...
  9. Group Policy shutdown script preventing PC from shutting down

    in Windows 10 Customization
    Group Policy shutdown script preventing PC from shutting down: On my machine, I have a script which shuts a Mac down via ssh. It's been tested and works ok. It doesn't require any input. This script is used on shutdown and is set in local GPO. However, when ever this is set, the PC does not shutdown and simply shows the shutting down...
  10. my gpedit is not run.

    in Windows 10 Drivers and Hardware
    my gpedit is not run.: I very try to run my gpedit but is not found in my windo 10. way it can be possibal ? https://answers.microsoft.com/en-us/windows/forum/windows_10-hardware/my-gpedit-is-not-run/17913733-edb5-4eac-a192-166a07d9f631

Users found this page by searching for:

  1. win 10 gpedit shutdown script does not run

    ,
  2. shutdown script gpedit breaks

    ,
  3. gpedit shutdown not working restart is