TechSpot

Edit shutdown action

By SINEKT
Jun 16, 2011
Post New Reply
  1. Hello !



    I work in IT and do pretty much everything, from maintenance to scripting... :) I am in desperate need of a way to make some Windows computers send emails when powered on or off. In Windows PRO versions there is no problem, as we have shutdown scripts. No problem for startup mail either, as we have the sweet startup folder.



    But how do I send an email on shutdown, on a Windows XP Home edition ? I tried a lot of stuff to no avail. I searched for like over a week. Then I found a little registry mod that removes the standard shutdown button and replaces it with a dropdown menu, Vista&7 like. But this is a bit awkward, as we would like not to tamper with the original design of the start menu.



    By now, I figured the only way to do this is to find the "something" in the OS that contains the 3 button shutdown pop-up menu (the one that appears in the middle and fades everything to grey) and edit it, adding the mailing command.



    I already opened with resource hacker half of the system32 folder, then I just decided that opening every OS file to find the needle in the bitstack was a bit supid :D Do I have any chance of finding and editing the file/registry key or whatever it is that contains the action binded to the shutdown button ? Or by any other means / 3rd party software ? Or maybe there is some other way I could run a shutdown script on XP Home ? Cause this is what I ultimately need, to run a simple 1-line command at shutdown.



    P.S.: I know I can do it by creating a .BAT with shutdown -s -t X plus my line and use that as a shutdown link, but the idea is to do it without users knowing it, so they HAVE to shutdown the computer the usual way, not through a BAT file.
     
  2. Matthew

    Matthew TechSpot Staff Posts: 5,268   +92

    This is admittedly out of my league, but I thought it'd be worth noting that you should be able to accomplish this with an AutoHotkey script. Unless someone chimes in with a different solution, I would recommend opening a thread on the AHK forum and I bet someone can help you out.
     
  3. SINEKT

    SINEKT TS Rookie Topic Starter Posts: 23

    Well, I never thought of this... I actually use AHK at home, because I missed the G keys on my dead Logitech G11 keyboard :D Will give it a try.
     
  4. jobeard

    jobeard TS Ambassador Posts: 9,333   +622

    but using AutoHotkey script is procedural, ie works only if the user follows direction.

    the original question was to change the ACTION and then it would not matter
    how the shutdown was invoked - - consider even taskmgr->shutdown->{restart or turn off}
     
  5. SINEKT

    SINEKT TS Rookie Topic Starter Posts: 23

    The users I am talking about aren't that experienced with computers and generally shut down with mouse click, from start menu. I already asked on AHK forums and it seems there might be a way to actually do this.

    But I wouldn't mind if I find out how to modify the windows thingy. It sounds naughtier :haha:
     
  6. jobeard

    jobeard TS Ambassador Posts: 9,333   +622

    in programming, we call changing the action to be the generalized solution
    and the AutoHotkey script to be a specific solution.
     
  7. jobeard

    jobeard TS Ambassador Posts: 9,333   +622

  8. jobeard

    jobeard TS Ambassador Posts: 9,333   +622

    XP/Home will not be able to do this trick, but any PRO edition will

    get a command prompt in an admin logon; enter gpedit.msc
    (this is the group policy editor)

    now navigate;
    Computer Configuration ->Windows Settings->Scripts->Shutdown​
    You can add your xxx.bat file there

    btw: files identified in this manner are stored in
    C:\WINDOWS\system32\GroupPolicy\Machine\Scripts\Shutdown
     
  9. SINEKT

    SINEKT TS Rookie Topic Starter Posts: 23

    Two things I forgot to mention:

    1. The sollution needs to be FREE.

    2. I know XP PRO can do this, but this is not an option either.
     
  10. jobeard

    jobeard TS Ambassador Posts: 9,333   +622

    the restriction to /Pro in post#8 applies only to the use of GPEDIT.MSC.

    If you find this directory existing on your system(s)
    C:\WINDOWS\system32\GroupPolicy\Machine\Scripts\Shutdown ​
    then anything stored there will run prior to system shutdown
     
  11. SINEKT

    SINEKT TS Rookie Topic Starter Posts: 23

    Ok, this is good to know. Will try it when I get the chance.

    L.E.: I just tried this, but on my PRO XP at the office and it doesn't work. Gpedit on default in the scripts sections, and copied my .bat file to the directory. The code inside the batch file works when tested with copy/paste in command prompt. But after shutdown & power-on, no mail in my inbox...

    Now I'm downloading a trial of VmWare, maybe I can install a copy of XP Home and test it on Home too. I don't really have access to the actual computer in need for this, right now.
     

Similar Topics

Add New Comment

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...