Sledgehammer - Windows 10 Update Control

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

  1. Nongshim

    Nongshim Guest

    Cmon now lol, I didnt know that you could download defender updates without wu service. So the script works great. :)
     
  2. NsaFarm

    NsaFarm MDL Junior Member

    Mar 29, 2017
    66
    11
    0
    #42 NsaFarm, Apr 15, 2017
    Last edited: Apr 15, 2017
    What about the BITS service? On 7 it is needed for windows update to return anything. It is present on 10 too.

    The script just keeps re-calling itself on 10 and popping up windows.
     
  3. pf100

    pf100 Duct Tape Coder

    Oct 22, 2010
    2,069
    3,447
    90
  4. pf100

    pf100 Duct Tape Coder

    Oct 22, 2010
    2,069
    3,447
    90
  5. Tiger-1

    Tiger-1 MDL Guru

    Oct 18, 2014
    7,897
    10,733
    240
    @pf100 Hi dude, thanks a lot for the update as ever your contribution here is very apreciated :good3:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. NsaFarm

    NsaFarm MDL Junior Member

    Mar 29, 2017
    66
    11
    0
    #46 NsaFarm, Apr 15, 2017
    Last edited: Apr 15, 2017
    Same script works on windows 7. I literally copy and pasted the folder. Something goes wrong after it elevates on my 10 system.


    Heh, as to BiTS good to see pretty much nothing uses it but 2 games and some remote management apps. I can just add the extra lines. I don't leave anything that can download files in the background running except for eset. Completely removed defender already.


    edit: Its the net command that kicks off the loop. If I comment it out and run as admin the script works.
     
  7. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,104
    24,378
    340
    ^^If the net command for the self elevation fails it's either the AV blocking access (JBenal reported it for Commodo Antivirus) or borked system files :g:.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. NsaFarm

    NsaFarm MDL Junior Member

    Mar 29, 2017
    66
    11
    0
    I tried "net session". It is dependent on the server service which I turned off since I don't share/serve anything.
     
  9. rpo

    rpo MDL Expert

    Jan 3, 2010
    1,447
    1,421
    60
    Înstead of "net.exe session" try "fltmc".
     
  10. NsaFarm

    NsaFarm MDL Junior Member

    Mar 29, 2017
    66
    11
    0
    that gives access is denied error.
     
  11. pf100

    pf100 Duct Tape Coder

    Oct 22, 2010
    2,069
    3,447
    90
    Your system is borked.
    Change the line:
    net.exe session >nul 2>&1 && goto GotPrivileges
    to
    goto GotPrivileges
    and run as admin, like you said earlier.
     
  12. rpo

    rpo MDL Expert

    Jan 3, 2010
    1,447
    1,421
    60
  13. antonio8909

    antonio8909 MDL Guru

    Feb 16, 2014
    3,111
    1,516
    120
    Hi,

    Since the last CU, when I try to run the file, it runs CMD and enters in a loop of open CMD, close CMD, open CMD, close CMD. And I need to press Alt+F4 for close it.

    Is there any fix?

    Thanks
     
  14. rpo

    rpo MDL Expert

    Jan 3, 2010
    1,447
    1,421
    60
    Try to run as admin.
     
  15. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,104
    24,378
    340
    Delete or REM:

    Code:
        >nul 2>&1 (net.exe session || (cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "", "", "runas", 1 > "%temp%\getadmin.vbs" & cscript //nologo "%temp%\getadmin.vbs" & del /f /q "%temp%\getadmin.vbs" & exit))
    
    Then run via right-click as admin.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. pf100

    pf100 Duct Tape Coder

    Oct 22, 2010
    2,069
    3,447
    90
    Use the workarounds posted by rpo and s1ave77 until I install the Creators Update and make a proper fix. I've been putting off installing it because of the problems it causes.
    I'll try installing CU on my least used laptop sometime in the next few days and will have it worked out soon. Sorry for the inconvenience.
     
  17. rpo

    rpo MDL Expert

    Jan 3, 2010
    1,447
    1,421
    60
    I run the script after CU on 32 and 64 bits OS without any issue.
     
  18. pf100

    pf100 Duct Tape Coder

    Oct 22, 2010
    2,069
    3,447
    90
    Another borked install, eh? I should have known. :)
     
  19. rpo

    rpo MDL Expert

    Jan 3, 2010
    1,447
    1,421
    60
    #59 rpo, May 27, 2017
    Last edited: May 30, 2017
    Or replace with :

    Code:
    set "params=Problem_with_elevating_UAC_for_Administrator_Privileges"&if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
    fsutil dirty query %systemdrive%  >nul 2>&1 || (
    rem    The following test is to avoid infinite looping if elevating UAC for Administrator Privileges failed
    If "%1"=="%params%" (echo Elevating UAC for Administrator Privileges failed...&echo Right click on the script and select 'Run as administrator'&echo Press any key for exiting&pause>nul 2>&1&exit)
    cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%params%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs"&exit)
    If there is a problem when trying to elevate UCA, these instructions prevent an infinite loop. However the best solution is to start the script by "Run as Administrator", or if a shortcut is created, change the properties of the shortcut to start the script as admin.

    Assuming the script is run as administrator, it may been shortened this way :
    Code:
    sc config wuauserv start= auto & sc start wuauserv
    for /f "tokens=2 delims==" %%a in ('wmic cpu get AddressWidth /value') do (set arch=%%a)
    IF %arch% == 32 (set "wumt=%~dp0wumt_x86.exe") else (set "wumt=%~dp0wumt_x64.exe")
    Start "" /max "%wumt%" -update "-onclose sc stop wuauserv" "-onclose sc config wuauserv start= disabled"
    That's all folks.
     
  20. pf100

    pf100 Duct Tape Coder

    Oct 22, 2010
    2,069
    3,447
    90
    #60 pf100, May 31, 2017
    Last edited: May 31, 2017
    (OP)
    Your elevation check code has been incorporated into v2.1.3 with all due credits. Thanks, rpo