Sledgehammer - Windows 10 Update Control

Discussion in 'MDL Projects and Applications' started by pf100, Nov 28, 2016.

  1. Whistler4

    Whistler4 MDL Member

    Jul 30, 2015
    204
    192
    10
    I could be wrong, and I imagine @rpo will let us know, but it looks like his cmd script repeats every hour at the :next line from the bottom line and the cmd window might need to stay open to do so. You could temporarily rem the @echo off line at the top (or delete it) to see the script displayed to know that it's not just blank. The results are also piped to a log file.

    You can put the portable version folder on your desktop and run it from there if you want.

    If you have a pre-1809 backup, you could restore and see if the Wrapper Script and Task Scheduler works correctly before doing the reinstall. But you know that.
     
  2. rpo

    rpo MDL Expert

    Jan 3, 2010
    1,446
    1,421
    60
    Absolutely! And i'd avoid using some 3rd party software which can have non expected effects on Windows.
     
  3. rpo

    rpo MDL Expert

    Jan 3, 2010
    1,446
    1,421
    60
    You got a cmd window staying there and waiting for 1 hour until restarting wdu.cmd. You can minimize the window. If you do not run as admin, this is done automatically since the script is reentered and the window will be minimized. This is caused by the "2" in the instruction at line 8 :
    Code:
    cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%params%", "", "runas", 2 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs"&exit
    . If you replace the "2" by "0", you will get no window at all.
     
  4. Homer712

    Homer712 MDL Member

    Oct 22, 2018
    118
    45
    10
    Thanks guys, and I agree that possibly a fresh install is in order. I have images of fresh installs going back at least three "feature updates" so that should not be an issue. I'll come back with results in a few days. Thanks for all the assistance (and patience).
     
  5. Whistler4

    Whistler4 MDL Member

    Jul 30, 2015
    204
    192
    10
    Good decision. When you first offered to modify the script so that it doesn't create tasks, I thought one of four things would result: a fork, the end of Task Scheduler integration for the primary script, customized modifications ad infinitum, or sticking with what works for almost all users.
     
  6. pf100

    pf100 Duct Tape Coder

    Oct 22, 2010
    2,069
    3,447
    90
    I would never make a neutered version of the script a released version. I was only offering a custom version just for him but quickly realized it's just a bad idea.
     
  7. Whistler4

    Whistler4 MDL Member

    Jul 30, 2015
    204
    192
    10
    Right. That's what I meant about custom versions -- a lot of work and a slippery slope. I know you'd never release any version that doesn't do the job well. A fork, of course, becomes someone else's problem but loss of your control. And when I referred to sans Task Scheduler, I meant a possible future paradigm change that still had efficacy, but there's really nothing to fix now concerning tasks for your user base as a whole. You have an excellent tool!
     
  8. pf100

    pf100 Duct Tape Coder

    Oct 22, 2010
    2,069
    3,447
    90
    I can't imagine Task Scheduler being disabled in official releases of Windows 10. But if that day ever did arrive I could handle it. The script already does things like that. When you run the script, and while it's checking for updates, the script creates a temporary file called WU-keep-alive.cmd that hides its own command prompt and runs "net start wuauserv" every 10 seconds so that the windows update service can't stop running, because if it did, updates would fail on a really slow internet connection. When you close WUMT or WuMgr after updating or for whatever reason, WU-keep-alive.cmd is automatically deleted. The next time you run the script and WUMT or WuMgr is running, look in the script folder and you'll see WU-keep-alive.cmd. You can see it running in Task Manager. Then when you're all done you can see the file isn't running and has been deleted.
     
  9. Whistler4

    Whistler4 MDL Member

    Jul 30, 2015
    204
    192
    10
    Very interesting info on the script capabilities. But I'm sorry I wasn't more clear about what I meant with possible future Task Scheduler non-integration. I'm not suggesting it at all, but it looks like by your choice (not MS disabling TS) you could bypass TS with @rpo's script and your internal WUB functionality, which you said you could replicate, if you deployed it. But again, why bother?

    I'm afraid I'm sucking the air out of the bandwidth here. So I'll drop this line of comments. :)
     
  10. rpo

    rpo MDL Expert

    Jan 3, 2010
    1,446
    1,421
    60
    #1090 rpo, Feb 5, 2019
    Last edited: Feb 5, 2019
    IMHO, it's a bad good idea suppressing tasks scheduler and replacing with cmd scripts. It's possible, but not advisable.
     
  11. Homer712

    Homer712 MDL Member

    Oct 22, 2018
    118
    45
    10
    Fresh install this morning of Win10 1709 from a USB stick installer. First and only program installed was WUMT Script. After first run the two Task Scheduler items were created. Per Task Scheduler, next run time was to be 5:01 AM. Nothing, although the next run time changed to 6:01 AM (I changed the time from 6 hours to 1 hour). 6:01 AM came and went, nothing. Again, next scheduled run time changed to 7:01 AM. 7:01 AM came and went, again nothing.

    Now, the only thing I can think is that either the script is actually running per the Task Scheduler but the "Last Run" times are not being updated, or the script just isn't running as intended.
     
  12. pf100

    pf100 Duct Tape Coder

    Oct 22, 2010
    2,069
    3,447
    90
  13. Homer712

    Homer712 MDL Member

    Oct 22, 2018
    118
    45
    10
    Solution Found (at least in my case). Just could not let go of the idea that this had to be something incredibly simple that I just was not seeing. After finding that the fresh install of 1709 was of no help, I just used my latest MR backup image to restore the hard drive to yesterday morning. Prior to fooling around with WUMT I was using WUMgr but never loaded the drop down menu/Tools/Defender Update/Create Definition Update Task. Did that and it had the same issue as WUMT. Just not running! Looked and looked again at the task to see if anything jumped out at me. Something finally did. The WUMgr task that gets created has a start time of 5:00 (don't remember if it was AM or PM, but that doesn't matter here), and then run every 6 hours (which I had already changed to every hour before having it create the task. My thought was "I wonder if it's waiting for that first 5:00 (AM or PM) time trigger to come around." Changed that setting to "Run at login, wait 15 minutes prior to first run, then run every hour. BAM!!!! It's working. First run after login, 9:17 AM, next run 10:17 AM (I have history turned on), next run 11:17 AM, and finally a run at 12:17 PM (just wanted to make sure it wouldn't hiccup at the cross over from AM to PM.

    Once WUMgr creates the task it must stay put, as I've run WUMgr a few times and the Task Scheduler task has not been modified back. A good number of posts back, when I asked about changing the WUMT time from 6 hours to 1 hour I was told to do it in the script. I'm assuming I was told to do it that way because it's being overwritten when the WUMT window comes up saying "Creating Tasks." Don't know, guessing.

    In any event, I'm running just fine, so thanks for all the help and putting up with my questions.
     
  14. pf100

    pf100 Duct Tape Coder

    Oct 22, 2010
    2,069
    3,447
    90
    It's just the WDU task you had a problem with, right? Would you do us all a favor and open Task Scheduler, right click the working WDU task, export as an XML file, and send it to me so I can examine it? I'll message you.
     
  15. rpo

    rpo MDL Expert

    Jan 3, 2010
    1,446
    1,421
    60
    @Homer712 @pf100
    If it works now, it's a miracle! Did you light a candle or invoke an Indien sorcerer? I believe we can isolate the wdu task from the script, wumt, wumgr and Windows defender period. It's a trivial task executing a cmd file.
     
  16. Homer712

    Homer712 MDL Member

    Oct 22, 2018
    118
    45
    10
    Replied to the pf100 PM, but will post the files here as well. Hope it helps.
     

    Attached Files:

  17. app_raiser

    app_raiser MDL Junior Member

    Mar 18, 2018
    93
    42
    0
  18. rpo

    rpo MDL Expert

    Jan 3, 2010
    1,446
    1,421
    60
    Wub_task runs only after a reboot or a login executing wub.exe /d /p. Whenever you run the script, wub_task (and wdu) is deleted and recreated but not started (the script deals with wub.exe). It will run after the next reboot or logout/login sequence.
     
  19. rpo

    rpo MDL Expert

    Jan 3, 2010
    1,446
    1,421
    60
    These files are not the WDU xml files.
     
  20. pf100

    pf100 Duct Tape Coder

    Oct 22, 2010
    2,069
    3,447
    90
    No, they're not. I think he was originally going to post it, but I asked him for whatever it was that eventually worked for him so I could analyze it..