Windows shutdown script fustercluck



  • Ever since cutting the school workstations over from XP to 7, I've had trouble with the shutdown script I use for slow maintenance tasks like updating software with slow installers (Office, Java, Adobe Reader and the like), applying Windows Updates reliably and defragmenting disks. Windows 7 is quite hard to persuade to just launch a shutdown script and leave it running until it's bloody well finished. It has many creative ways to screw that up.

    Even after setting an infinite timeout on startup and shutdown scripts with Group Policy, Windows 7 would still kill any shutdown script that ran longer than 15 minutes. Turns out there's a new registry key that puts a shutdown timeout on the Group Policy service itself: a DWORD at HKLM\SYSTEM\CurrentControlSet\Services\gpsvc\PreshutdownTimeout. There is apparently no reserved value meaning Infinite, either - best you can do is set it to 0xffffffff and trust that four billion milliseconds will be enough.

    That worked pretty well, but after one particularly patchy Patch Tuesday I had a random assortment of workstations fail to update themselves properly, and that's when I found out that Windows 7 considers the machine to be idle whenever it has had no keyboard or mouse input for a while, regardless of how busy the CPU and disks might be: after the 10 minute Group Policy script timeout barrier and the 15 minute PreshutdownTimeout barrier comes the 20 minute Balanced Power Scheme barrier. It's really really fun to walk up to a workstation first thing in the morning and hit the power button, only to have it wake up, grind away for another 15 minutes completing what should have been last night's updates, and then finish shutting down.

    So for a while now I've had the shutdown script save the result of powercfg -getactivescheme to a file and then do powercfg -setactive scheme_min to force it not to sleep the machine half way through its maintenance work (the matching startup script has some stuff to restore the saved power scheme). And I thought that was working pretty well, but even so there was still the odd workstation I'd sometimes find asleep instead of properly shut down.

    Tonight I've finally stared at enough Event Viewer entrails to work out the unbelievable truth: if a Windows 7 box idles and sleeps, and then wakes on a scheduled task that shuts it down and triggers the shutdown script, then even though the shutdown script does powercfg -setactive scheme_min followed by assorted powercfg -change -*-timeout-ac 0 things to disable every kind of sleep-on-idle, there's a chance - not a certainty, just a chance - that a couple of minutes after waking up it will just go back to sleep again anyway.

    So I've now dispensed with the powercfg foolery altogether and am using Insomnia instead. Let's see where the next barrier is.



  • Awww, why didn't you create a VB6 app to mock a key press?



  • @chubertdev said:

    Awww, why didn't you create a VB6 app to mock a key press?

    Or use an Arduino and some sort of actuator to keep moving the mouse.



  • ITSHUTDOWNROBOT
    <v



  • @flabdablet said:

    best you can do is set it to 0xffffffff and trust that four billion milliseconds will be enough.

    Well, if your shutdown script runs for 50 days, you might, just might, be doing something wrong...


  • Grade A Premium Asshole

    @Keith said:

    Or use an Arduino and some sort of actuator to keep moving the mouse.

    Have the users put their mouse in some sort of vibrating baby seat.



  • or buy one of my patented invention

    You will need

    • Mouse with light sensor
    • Adhesive tape
    • newtons cradle (with battery backup)

  • Grade A Premium Asshole

    You are going to need a pretty large vacuum vessel also, and a vacuum pump. Then @algorythmics is going to end up putting his junk in it for some sexy thrills and then no one will want to use it again.



  • GIS failed me in searching for a picture of a live mouse on a Newton's cradle.



  • Or start notepad.exe and enable speech recognition.


    Filed under: What could possibly go wrong?


  • Grade A Premium Asshole

    You mean you actually were unable to find a specific picture on the internet? We need to talk to Getty Images so they can get on that shit.



  • Yeah, I thought that one of the rules of the internet is that, if you can think of it, it's on the internet.




  • Grade A Premium Asshole

    In this case, it would not be a part of Rule 34, so perhaps that is why? I mean, that would be a pretty fucking specific fetish if it were...



  • Paging @algorythmics


  • BINNED

    @Monarch said:

    or buy one of my patented invention

    I want three!



  • @Onyx said:

    I want three point one four one five nine two six five three five nine!

    FTFY



  • @Onyx said:

    I want three!

    I am setting up my kickstarter page, online order soon are going to be opened to the public.

    @Intercourse said:

    You are going to need a pretty large vacuum vessel also, and a vacuum pump.

    don't they have the toy with magnetic field booster with battery to compensate for the lost of energy?


  • BINNED

    @chubertdev said:

    FTFY

    That... took me an embarrassingly long time to figure out.

    I still think I'm missing something. Is there a nerdy song somewhere I'm not aware of with that as lyrics or something?



  • @Onyx said:

    That... took me an embarrassingly long time to figure out.

    I still think I'm missing something. Is there a nerdy song somewhere I'm not aware of with that as lyrics or something?

    Bloodhound Gang had "three point one four"

    But yeah, go look at the original patent above for a while


  • BINNED

    @chubertdev said:

    But yeah, go look at the original patent above for a while

    Oh... Ok, I think that's my cue, brain gone for the night.



  • @Intercourse said:

    You are going to need a pretty large vacuum vessel also, and a vacuum pump. Then @algorythmics is going to end up putting his junk in it for some sexy thrills and then no one will want to use it again.

    You think he won't do the same with the vibrating baby seat?


  • Discourse touched me in a no-no place

    @chubertdev said:

    Wait, I found out why there's no mouse:

    File not found."

    I tried going to eonline.com in a different browser, then pasting the URL, no dice. GIS to the rscue, though.



  • @chubertdev said:

    why didn't you create a VB6 app to mock a key press?

    Because I'd already tried an app that uses that technique, and it wouldn't stay running from a shutdown script.



  • @FrostCat said:

    File not found."

    I tried going to eonline.com in a different browser, then pasting the URL, no dice. GIS to the rscue, though.


  • Grade A Premium Asshole

    @Keith said:

    You think he won't do the same with the vibrating baby seat?

    I didn't think that through did I?...



  • Hey guys my kick-starter is also going to sell this kit based on my other patent.

    let me know how many of you want this. I can give you early bird pricing.



  • I'd totally back this, but only if one of the tiers was payable with [s]dick pics[/s] tasteful portraits of male genitalia.



  • This is a respectable forum.where civilized conversation taking place. why are you trying to degrade it? wtf is wrong with you?



  • @Monarch said:

    This is a respectable forum.where civilized conversation taking place. why are you trying to degrade it? wtf is wrong with you?

    You are quite right, sir or madam. I shall amend my post forthwith!

    Edit: The post has been amended! May it better suite the refined cultural atmosphere of these forums. You have my sincere ablutions and hopefully they may in some small way make up for my prior transgressions, good fellow internet citizen.


  • Discourse touched me in a no-no place

    Well, duh. You found it first, right? I suspect it's referer-blocked, and you saw the image from the page it was embedded in, in which case, of course it would work.


  • Discourse touched me in a no-no place

    @Monarch said:

    let me know how many of you want this. I can give you early bird pricing.

    The alarm should be driven by the computer the mouse is keeping alive, for extra WTFery.



  • @FrostCat said:

    Well, duh. You found it first, right? I suspect it's referer-blocked, and you saw the image from the page it was embedded in, in which case, of course it would work.

    Works here, as well. Even with a 200 instead of a 304.


  • Discourse touched me in a no-no place

    @chubertdev said:

    Works here, as well. Even with a 200 instead of a 304.

    Weird--now it works for me.



  • a bit of history (to contribute to this much more civilized conversation)

    In the 18th century they did not have digital photography, painting took to much time.
    so the method of delivery was a bit different.

    bottom line kickstarter does not support your method of payment. but if Vincent was alive he might have appreciated your gesture.



  • @Monarch said:

    bottom line kickstarter does not support your method of payment. but if Vincent was alive he might have appreciated your gesture.

    Truly, a man of vision. He had the forbearing to see over a hundred years before what protest would be needed for the coming inequities.

    It is most unfortunate that Kickstarter should be so crass as to limit payment to pure monetary compensation. Do they have no shame to limit themselves to such purely mercantile endeavors?



  • I couldn't put it in better words.

    Here your earned van gogh coin of appriciations





  • ...

    ...



  • @Monarch said:

    In the 18th century they did not have digital photography, painting took to much time.

    However, by 1888 non-digital photography was well established. Film was relatively new, having been invented by George Eastman in 1884, but the collodion process (glass plate and ferrotype) had been in use since 1851, and dry gelatin glass plates since the 1870s.

    Although not as fast as digital photography, he could have produced (or had produced on his behalf) a (un?)suitable portrait fairly quickly without mutilating himself, had he chosen to do so.



  • Sounds overly artificial. Additionally, 'lel' (or usually 'oorlel') refers only to the earlobe, not to the entire ear.



  • @PleegWat said:

    Additionally, 'lel' (or usually 'oorlel') refers only to the earlobe, not to the entire ear.

    I lel & lul are also pronounced rather differently. It's a rather big jump going from cock to earlobe to ear.

    Lel has an additional meaning of hitting someone, like in 'Ik gaf mijn collega een lel met mijn cluebat.'



  • @Luhmann said:

    'Ik gaf mijn collega een lel met mijn cluebat.'

    Kinky office politics and he learned something? I approve!



  • @OffByOne said:

    he learned something

    Although I lel-ed with the cluebat I doubt any clue will be sticking
    On the positive side: no brain damage was detected either



  • @Luhmann said:

    Although I lel-ed with the cluebat I doubt any clue will be sticking
    On the positive side: no brain damage was detected either

    As long as you didn't spray clue-goo all over his face, all is well, I guess.



  • @OffByOne said:

    As long as you didn't spray clue-goo all over his face, all is well, I guess.

    apparently this specimen has a rather thick skull



  • @Luhmann said:

    On the positive side: no brain damage was detected either
    He'd have to have a brain to damage first.



  • Why do this as a shutdown script? if you have any laptop users, they probably hate you. Microsoft has been adding features to kill unresponsive shutdown scripts for a long time now. They are sending you a message that you should do this a different way.



  • Hah! This new guy at the office was complaining of his mouse wiggling all the time at regular intervals. We all thought he was fucking crazy or had a hair in his mouse. This went on for weeks. Finally, he discovers that someone else in our office plugged one of these in to his computer: http://www.cru-inc.com/products/wiebetech/mouse_jiggler/



  • @Jaime said:

    Why do this as a shutdown script?

    So that all the potentially lengthy maintenance shit happens after the user has finished with the machine for the day. This is way less intrusive than having it happen at startup, and much less prone to causing trouble than having it happen in the background.

    @Jaime said:

    if you have any laptop users, they probably hate you.

    Most of our workstations are desktops. We have about ten laptops available for teachers to borrow.

    I run my shutdown scripts visible, and my laptop users know that if they really do just want to shut down and get out, it's fine to click the big red X.

    The shutdown script is a group policy thing, so when the laptops are off campus and can't see the domain controller, they don't run at all.

    All I ask of my laptop users is that they bring the machine back to school and make it do a full, uninterrupted restart cycle before complaining to me that stuff is outdated or missing. We get on just fine.

    @Jaime said:

    Microsoft has been adding features to kill unresponsive shutdown scripts for a long time now.

    Quite so. Although precisely what an unattended-by-design maintenance script could be expected to "respond" to seems to me ill-thought-through.

    @Jaime said:

    They are sending you a message that you should do this a different way.

    Obviously shutdown scripts are Old and therefore No Good Any More, and obviously MS would prefer that nobody ever gets a chance to see a black window with inscrutable text scrolling up it on any product ever. That is because MS, like the rest of this shitty industry, has an incurable case of the Everything Is A Phone brain worms.

    Personally, I distrust shit that's supposed to work by magic because (a) it so often doesn't and (b) when it fails it's almost completely impossible to work out what to do about that.

    Did you have a specific alternative in mind?


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.