PowerShell script that will download monthly updates into folders from Microsoft

Welcome Forums General PowerShell Q&A PowerShell script that will download monthly updates into folders from Microsoft

Viewing 7 reply threads
  • Author
    Posts
    • #256130
      Participant
      Topics: 3
      Replies: 1
      Points: 17
      Rank: Member

      Every month when the latest Microsoft OS updates are released I have to go to the Microsoft Update Catalog website ( https://www.catalog.update.microsoft.com/Home.aspx), and do the following:

      1. Type in the month and the OS version of the updates that I want to download (e.g. 2020-09 2012 R2).

      2. Copy the names of each of the updates and create folders with these names on my local computer

      3. Download the updates into the folder names matching the updates

      I have to repeat this process to manually download updates for Server 2008R2, Server 2012R2, Server 2016, and Server 2019.

      This has to be done since these updates don’t always appear within the SCCM Software Center console and because it always takes the SCCM team around a month to approve the updates after they have been released from Microsoft. I always need to install the latest updates whenever I patch servers.

       

      Once these updates have been downloaded I put these updates into a folder on a NAS so that these updates can be copied over to servers that need them.

      So I’m hoping that a PowerShell script can be written where I can provide the month and OS version (e.g. 2020-09 2012 R2) that will then:

      1. Create the folder names corresponding to the updates in the target folder

      2. Download the updates into the folder names matching the updates

      • This topic was modified 2 months, 2 weeks ago by ee124209.
    • #256139
      Participant
      Topics: 8
      Replies: 669
      Points: 2,631
      Helping Hand
      Rank: Community Hero

      Well hope no more because it’s absolutely possible! If you hit a snag come back and show what’s not working and plenty of us will be happy to help. Happy scripting!

    • #256145
      Participant
      Topics: 3
      Replies: 1
      Points: 17
      Rank: Member

      Can you provide me with the PowerShell script that will do this?

    • #256217
      Participant
      Topics: 0
      Replies: 46
      Points: 250
      Helping Hand
      Rank: Participant

      ee124209

      You can refer below scripts which will help you to achieve your task.
      1) Script is to download the updates based on the KB article
      https://gallery.technet.microsoft.com/42-POWERSHELL-TO-UPDATES-7071ab32

      2) How convert html into PowerShell object
      https://sysjam.wordpress.com/2016/01/08/consuming-html-tables-with-powershell/

      Thanks,
      Nitesh

      • This reply was modified 2 months, 1 week ago by Evila Osa. Reason: Adding one more link
    • #258892
      Participant
      Topics: 0
      Replies: 3
      Points: 19
      Rank: Member

      Hi sorry for hijacking the thread, but I´ve been trying to get this to work now for a while now but there still is something I´m not getting. I´ve managed to get it to download the KB´s from the txt file but I can´t get it to filter it will always download everything under the KB# so both x86 and x64.

      I´ve been trying webscraping to narrow down how til filter it out and got it somewhat to work when I did it in a small script but when I tried to implement it to the script it wouldn´t work only says “No such article exist”

      Can someone please point to me what I´m doing wrong…

      In line 7 there is the issue if I comment out the things after # the script runs but downloads all the KB´s if uncommented it says there is no KB´s

       

    • #258934
      Participant
      Topics: 8
      Replies: 669
      Points: 2,631
      Helping Hand
      Rank: Community Hero

      Proper indentation as well as a decent IDE will help you see when you’re missing not only one, but two closing curly braces. You are also not showing how you populate your KB list.

    • #258985
      Participant
      Topics: 0
      Replies: 3
      Points: 19
      Rank: Member

      Hi Doug and thanks for the reply. Yeah sorry I didn´t post the whole script since it´s quite large but I guess you need all find out the problem. It´s basically the same script as Evila posted the link to but just with some tweeks I´ve made to get it to start do something.

      The KB are stored in a .txt file for now just on C:\Temp while testing I´ve just been using this KB for testing KB4576630

      Here is all the code

    • #260904
      Participant
      Topics: 0
      Replies: 3
      Points: 19
      Rank: Member

      Anyone got clue why it´s not working ?

Viewing 7 reply threads
  • You must be logged in to reply to this topic.