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

    Joined:
    Mar 29, 2017
    Messages:
    68
    Likes Received:
    11
    Trophy Points:
    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. Tiger-1

    Tiger-1 MDL Guru

    Joined:
    Oct 18, 2014
    Messages:
    6,205
    Likes Received:
    7,532
    Trophy Points:
    210
    @pf100 Hi dude, thanks a lot for the update as ever your contribution here is very apreciated :good3:
     
  4. NsaFarm

    NsaFarm MDL Junior Member

    Joined:
    Mar 29, 2017
    Messages:
    68
    Likes Received:
    11
    Trophy Points:
    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.
     
  5. s1ave77

    s1ave77 Has left at his own request

    Joined:
    Aug 15, 2012
    Messages:
    16,130
    Likes Received:
    24,279
    Trophy Points:
    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:.
     
  6. NsaFarm

    NsaFarm MDL Junior Member

    Joined:
    Mar 29, 2017
    Messages:
    68
    Likes Received:
    11
    Trophy Points:
    0
    I tried "net session". It is dependent on the server service which I turned off since I don't share/serve anything.
     
  7. rpo

    rpo MDL Expert

    Joined:
    Jan 3, 2010
    Messages:
    1,166
    Likes Received:
    990
    Trophy Points:
    60
    Înstead of "net.exe session" try "fltmc".
     
  8. NsaFarm

    NsaFarm MDL Junior Member

    Joined:
    Mar 29, 2017
    Messages:
    68
    Likes Received:
    11
    Trophy Points:
    0
    that gives access is denied error.
     
  9. pf100

    pf100 MDL Expert

    Joined:
    Oct 22, 2010
    Messages:
    1,906
    Likes Received:
    3,055
    Trophy Points:
    60
    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.
     
  10. rpo

    rpo MDL Expert

    Joined:
    Jan 3, 2010
    Messages:
    1,166
    Likes Received:
    990
    Trophy Points:
    60
  11. antonio8909

    antonio8909 MDL Guru

    Joined:
    Feb 16, 2014
    Messages:
    2,939
    Likes Received:
    1,414
    Trophy Points:
    90
    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
     
  12. rpo

    rpo MDL Expert

    Joined:
    Jan 3, 2010
    Messages:
    1,166
    Likes Received:
    990
    Trophy Points:
    60
    Try to run as admin.
     
  13. s1ave77

    s1ave77 Has left at his own request

    Joined:
    Aug 15, 2012
    Messages:
    16,130
    Likes Received:
    24,279
    Trophy Points:
    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.
     
  14. pf100

    pf100 MDL Expert

    Joined:
    Oct 22, 2010
    Messages:
    1,906
    Likes Received:
    3,055
    Trophy Points:
    60
    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.
     
  15. rpo

    rpo MDL Expert

    Joined:
    Jan 3, 2010
    Messages:
    1,166
    Likes Received:
    990
    Trophy Points:
    60
    I run the script after CU on 32 and 64 bits OS without any issue.
     
  16. pf100

    pf100 MDL Expert

    Joined:
    Oct 22, 2010
    Messages:
    1,906
    Likes Received:
    3,055
    Trophy Points:
    60
    Another borked install, eh? I should have known. :)
     
  17. rpo

    rpo MDL Expert

    Joined:
    Jan 3, 2010
    Messages:
    1,166
    Likes Received:
    990
    Trophy Points:
    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.
     
  18. pf100

    pf100 MDL Expert

    Joined:
    Oct 22, 2010
    Messages:
    1,906
    Likes Received:
    3,055
    Trophy Points:
    60
    #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