1.    27 Nov 2015 #1
    Join Date : Nov 2015
    Posts : 2
    Windows 7

    Windows 10 Home Shutdown Script


    Is it possible to run a script on shutdown on Windows 10 Home edition?
    Group Policy Editor (gpedit.msc) is not available.

    Already tried to modify registry
    Execute a script a startup and shutdown
    Tested successfully on Windows 10 Professional but won't work on Home.

    Also, tried through Task Scheduler without success
    Ramblings...: How to run a script on logout/shutdown in windows 7

    Any help would be great!

    Thanks in advance
      My ComputerSystem Spec
  2.    08 May 2017 #2
    Join Date : May 2017
    Brisbane, Queensland, Australia
    Posts : 2
    Windows 10 Home Edition (among others)

    Better late than never, I suppose.

    Since I only needed a script to run when a user was logged in and a (hybrid or otherwise) shutdown started, I was able to solve the problem using AutoHotKey. You can get AutoHotKey here: https://autohotkey.com/

    My specific problem is I wanted to dismount VeraCrypt volumes before a hybrid shutdown and this is the script I used (easily modified, read the comments):

    Code:
    ; run_before_shutdown.ahk, 2017-05-09, Grismar
    ; restart as admin, if not running as admin
    if not A_IsAdmin
    {
       Run *RunAs "%A_ScriptFullPath%"
       ; exit, as new instance takes over
       ExitApp
    }
    
    ; ensure only one instance of the script is running at any one time
    #SingleInstance, Force
    ; optionally, hide the icon from the system tray
    ; #NoTrayIcon
    
    
    ; On WM_QUERYENDSESSION event (before shutdown), run OnShutDown callback.
    OnMessage(0x11, "OnShutDown")
    return
    
    
    OnShutDown(){
        ; Run your command, in my case a silent dismount of VeraCrypt volumes
        Run, "C:\Program Files\VeraCrypt\VeraCrypt.exe" /s /q /d
        ExitApp
    }
    Note: running the script will cause a UAC dialog to appear, asking for admin privileges; that's how I like it, but you could get it to run as admin with a (somewhat insecure) shortcut / batch file.

    Note: I start this script as part of a batch that also mounts some drives I want to auto-dismount, but you could run it on Windows startup for a specific user (AutoHotKey doesn't run if no user is logged on).
      My ComputerSystem Spec
  3.    11 May 2017 #3
    Join Date : Apr 2017
    Posts : 1
    Windows 10 Pro (10.0.10240)

    I do not know for sure...

    Did you try to get a copy of gpedit.msc and throw it into the Windows 10 directory to see it it "sticks"?

    I cannot state for sure 100%, but I do not see why that won't work for you.
      My ComputerSystem Spec
  4.    11 May 2017 #4
    Join Date : May 2017
    Brisbane, Queensland, Australia
    Posts : 2
    Windows 10 Home Edition (among others)

    There are various threads about the lack of a policy editor (or editable policies for that matter) on Windows 10 Home. Like Brink mentions in this thread Policy Editor Not Available In Win 10 Home Edition Solved - Windows 10 Forums :

    "I find that trying to add Group Policy to an unsupported edition usually ends in disaster."

    My experience is similar. And that's apart from the fact that you're adding stuff from Windows versions you didn't pay for to a Windows version that doesn't support it. That's just a baby step away from running a pirated version.

    Also, both the OP and myself indicated that we tried various alternative solutions that ended up not working, or not working correctly or reliably. Why exactly the policy editor was kept absent from 10 Home is only for Microsoft engineers to know, but it seems there's technical reasons as well as commercial ones...
      My ComputerSystem Spec

 


Similar Threads
Thread Forum
Solved Screwed shutdown script
Oh Boy, well you learn from your mistakes they say:o I tried to run a script at shutdown on my W10 PC that would run a RoboCopy command. That did not work so I deleted it (So I thought) I may have deleted the proper shutdown script as my PC will...
General Support
PC Shutdown script does not work
Hi, I was used to run a script "at 20:30 shutdown -s" in Run.exe to shutdown my laptop at specific time in Windows 7, but in W10, it does not work. I tried to run this script in cmd.exe as administrator, but it does not work eather, because in...
Software and Apps
Hydranix's Telemetry Disabler (Script to stop Windows tracking you)
I wrote a quick batch script to disable some of the Windows 10 telemetry. It's interactive, safe*, and easy to use. Download Link: Script I'm working on a more comprehensive application to control the telemetry in windows 10. A true C++...
AntiVirus, Firewalls and System Security
Solved Windows 8.1 Calculator Install Script
Made a little script to install the old Win32 style calculator from Windows 8.1. Maybe someone will find it useful. :) While the batch file does not overwrite any system files, it does change the keyboard calculator button to open the 8.1 app...
Customization
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 16:16.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums