Using CMD script and VBScript to control Windows Update  

Page 1 of 8 123 ... LastLast
    Using CMD script and VBScript to control Windows Update

    Using CMD script and VBScript to control Windows Update

    CMD script for disabling auto-updates. VBScript for updating Windows Defender and checking for other updates.
    Published by Category: Windows Update & Activation
    31 Mar 2021
    Designer Media Ltd


    How to use CMD script and VBScript to control Windows Update in Windows 10


    The Enable or Disable Windows Update Automatic Updates in Windows 10 tutorial already lists a number of methods for controlling Windows Update. My tutorial is intended for members interested in playing with scripts.

    The attached "Matthew's preference.zip" contains the CMD and VBScript files that I have been using to disable automatic updates, run update checks, and update Windows Defender. The core commands in "Disable hijackers.cmd" are extracted from Sledgehammer with the author's consent. This script will lock (disable) the system files that force auto-updates. The locking has to be done via NSudo, which allows the script full privileges to run the commands. Another script "Metered or unmetered.cmd" lets users choose between metered and unmetered connection simply by entering an option number. I have run "Ethernet_as_metered_connection.reg" downloaded from Brink's tutorial, but the .reg file cannot be imported, as Registry Editor says "you have insufficient privileges to perform this operation". My script can perform the operations with sufficient privileges via NSudo, which has been included in my zipped file. When auto-updates have been disabled, the daily check for updates and Microsoft Defender update will also be disabled. So, I have been using Task Scheduler to run two VBScript files, "WDD_Updates.vbs" and "Check_for_updates.vbs", which will do the following in the background:

    Update Microsoft Defender at six-hour intervals without notification.
    Check for other updates every day. Bring up a message only when updates are found.

    "WDD_Updates.vbs" will automatically install definition updates (KB2267602) and updates for antimalware platform (KB4052623). The core commands in "Check_for_updates.vbs" are extracted from Microsoft Docs. My simplified version only searches for updates but not downloads and installs them. Note that the scripts will neither enable nor update Microsoft Defender if it has already been disabled.

    The scripts in my zipped file will do everything automatically, including importing "Scheduled Task.xml" and "WDD_Updates Task.xml". Everything in the scripts can be modified at will. Everything done by the scripts can be undone at your pleasure. You just have to go through the following after signing in as an administrator:


    1 Click here to download "Matthew's preference.zip" and extract the files.
    2 Double-click on "Disable hijackers.cmd" to run it. Unblock the .cmd file, and click on "Yes" if prompted by UAC. The file will lock the hijackers, the system files that force auto-updates.

    Using CMD script and VBScript to control Windows Update-disable-hijackers.jpg

    3 On completion, a CMD Prompt window will pop up, asking you whether you want to import "Scheduled Task".

    Using CMD script and VBScript to control Windows Update-do-you-want-import-scheduled-task.jpg

    4 If you select Yes, "Scheduled Task.xml" will be imported. "WDD_Updates Task.xml" will be imported only if Microsoft Defender is running at the moment of your selection. Both tasks can be modified, disabled, or deleted via Task Scheduler.

    5 On completion, another CMD window will pop up, asking you whether you want to set connections as metered.

    Using CMD script and VBScript to control Windows Update-do-you-want-set-connections-metered.jpg


    6 If you select Yes, another CMD window will pop up. Enter 1 for unmetered connections (Windows default). Enter 2 (recommended) for metered connections, which help prevent auto-updates. Restart Windows for it to take effect.

    Using CMD script and VBScript to control Windows Update-metered-unmetered.jpg


    7 If you want to undo everything done by the scripts, just double-click on "Undo everything.cmd".

    Using CMD script and VBScript to control Windows Update-undo-everything.jpg


    If you have not undone everything, you will see a pop-up dialog box when updates are found. You may select Yes to run Windows Update MiniTool (included in my zipped file). To view the updates found by VBScript, double-click on "# Updates found by VBScript". To exclude the updates found by VBScript, double-click on "# Add exclusions.vbs" or "# Auto-exclusion.vbs"; then, you will not be notified of the same updates again. To install/hide updates, use Windows Update MiniTool or any other tools of your choice.

    The scripts will also prevent automatic driver updates, including those for Intel HD Graphics drivers.


    If you need to run the command "sfc /scannow" mentioned in this tutorial, you firstly have to run "Undo everything.cmd", which will unlock the system files previously locked by "Disable hijackers.cmd". Otherwise, errors will arise because the locked files cannot be read by System File Checker (sfc.exe). After running "sfc /scannow" and finishing the related operations, you may re-run "Disable hijackers.cmd".


    VirusTotal detected no malware in "Matthew's preference.zip" .
    See the analysis results on VirusTotal. 👌

    Other screenshots:

    The one below shows "0x00000002 (2)", which denotes a metered connection.
    https://www.tenforums.com/attachment...pect-dword.jpg

    The one below shows metered connection has prevented the downloading of a cumulative update.
    https://www.tenforums.com/attachment...ive-update.jpg

    The one below shows metered connection has prevented the downloading of a language pack.
    https://www.tenforums.com/attachment...ge-options.jpg

    The one below shows available updates are listed on Windows Update MiniTool.
    https://www.tenforums.com/attachment...nd-updates.jpg

    The one below shows driver updates have been hidden via Windows Update MiniTool.
    https://www.tenforums.com/attachment...en-drivers.jpg

    The one below shows even security and quality updates will not be installed automatically.
    https://www.tenforums.com/attachment...ot-up-date.jpg

    The one below shows even critical updates will not be installed automatically.
    https://www.tenforums.com/attachment...al-updates.jpg

    The one below shows even a feature update will not be installed automatically.
    https://www.tenforums.com/attachment...do-image-1.jpg

    The one below shows the dialog box that pops up when updates are found.
    https://www.tenforums.com/attachment...dialog-box.jpg

  1. Brink's Avatar
    Posts : 56,295
    64-bit Windows 10 Pro for Workstations build 21359
       #1

    Great job @Matthew Wai
      My Computers

  2. Vineet Garg's Avatar
    Posts : 144
    Windows 10 Pro x64
       #2

    @Matthew Wai :

    Great Job Sir!

    My bad luck I can't rep you.

    Thanks & Regards. ...
      My Computer

  3. Matthew Wai's Avatar
    Posts : 5,050
    Windows 10 Home 20H2
    Thread Starter
       #3

    @Vineet Garg, what you said in your personal message could simply be said in a public post.

    I think MajorGeeks is reliable whether they make modifications or not.
    I don't think Google Translate is reliable when it comes to a tutorial.
    About rep, see this thread: Reputation and Badges
      My Computer

  4. Vineet Garg's Avatar
    Posts : 144
    Windows 10 Pro x64
       #4

    Matthew Wai said:
    @Vineet Garg, what you said in your personal message could simply be said in a public post.
    I think MajorGeeks is reliable whether they make modifications or not.
    I don't think Google Translate is reliable when it comes to a tutorial.
    About rep, see this thread: Reputation and Badges
    I did not want to take the thread somewhere else. So, just posted it there.
    Yes, MajorGeeks is reliable.
    Google Translate allows the translation of any text & certain doc files within seconds.
    I can't rep you because it says that i have to give rep to some other members before i can give it to you again.

    Thanks & Regards. ...
      My Computer

  5. DonMurray's Avatar
    Posts : 196
    os build 17143.950
       #5

    Using CMD script and VBScript to control Windows Update-image.png
    I have this issue to determine. I am going to try running this and see if it will still work even though Norton is control of the firewall this might still work. I may need to make my Norton firewall go to manual for a bit so I can allow the program. I am using Norton security
    Using CMD script and VBScript to control Windows Update-image-2-.png
    So even though my firewall is being controlled by Norton it gave me a choice to run Mathew's scripts

    - - - Updated - - -

    Norton Came up with a message stating that its going to switch to economy network usage. I pay for a Fiber Optic line and I have unlimited usage. So now I wonder how this is going to affect things as far as me downloading files or watching netflix. I am unsure what all a metered connection is going to do. I do see a metered or unmetered connection control utility with the zip extract and it works- It is easy to turn the metered connection on and off and that "Metered or unmetered.cmd" does work when I initiate it..- so about 1 hr later after installing the scripts- I watched some Youtube Videos and did not have any problems. Also I went into task manager and I do see the new activity so I conclude that Norton's firewall control did not interfere with Matthew's scripts. ok so about another hour has past and the tool showed a message that it found some updates and Matthew's readme answered my questions I watched a video from major geeks and it answered my burning questions on how to hide the updates. So I hid two of them. Super Cool I depend on my machines and need them to work without interruption and am grateful to have a handle on this. Now I can get back to learning about 3d modeling. THX
    Last edited by DonMurray; 09 Mar 2020 at 21:22.
      My Computer

  6. Matthew Wai's Avatar
    Posts : 5,050
    Windows 10 Home 20H2
    Thread Starter
       #6

    DonMurray said:
    I wonder how this is going to affect things as far as me downloading files or watching netflix. I am unsure what all a metered connection is going to do.
    Don't worry. A metered connection will not prevent downloading files or slow down your speed. It will just prevent Windows from automatically downloading updates.

    DonMurray said:
    I hid two of them.
    After hiding all of them, if you still see a pop-up message, you may run "# Add exclusions.vbs" to exclude unwanted updates, so that you will not be notified of them again.

    DonMurray said:
    Norton Came up with a message stating that its going to switch to economy network usage.
    You may manually switch to "No Limit" as shown below:

    Using CMD script and VBScript to control Windows Update-norton.jpg
    Source: Define the Internet usage for Norton
      My Computer

  7. Matthew Wai's Avatar
    Posts : 5,050
    Windows 10 Home 20H2
    Thread Starter
       #7

    W10 Tweaker said:
    I might like to understand why it works differently so as I might fix it properly at a future date.
    Next time, do not use WUMT to install definition updates. Go to Task Scheduler Library. Right-click on "WDD_Updates"-->"Run". Pay attention to "Last Run Result". If the result is "(0x0)" as shown below, the update should have been installed.
    Using CMD script and VBScript to control Windows Update-tasks.jpg

    Also, press the Windows key + R. Run the following to view the updates found by "Check_for_updates.vbs".

    Notepad "C:\#\Updates_found.txt"
      My Computer


  8. Posts : 9
    win 10
       #8

    I currently have windows defender permanently disabled in win 10
    can i just use steps 6 or 7 , or I have to use all the steps to turn on metered disable auto update
    please clarify
      My Computer

  9. Matthew Wai's Avatar
    Posts : 5,050
    Windows 10 Home 20H2
    Thread Starter
       #9

    @venky23, you still have to take steps 1 to 6.
    If you have already disabled Windows Defender, it will not be updated, and "WDD_Updates Task.xml" will not be imported.
      My Computer


 
Page 1 of 8 123 ... LastLast

Tutorial Categories

Using CMD script and VBScript to control Windows Update Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 03:59.
Find Us




Windows 10 Forums