locked
Powershell windows update limit to critical or cumulative RRS feed

  • Question

  • I downloaded and run the PS_WindowsUpdate script.  It currently has the 'type' set to 'Software' and it works - except that it does overkill.  If I run this on some Windows 10/1507 machines, it forces the upgrade to 1703.  I would like to be able to run it on somes of our 1800 workstations but control what type of update I get.  I have tried 'Type="Critical"' and 'Type="Security"', also 'Type='Cumulative'" (the latter to get only Cumulative updates) - tried this on one machine where I had uninstalled a Security update.  It still doesn't find it.  But if I put 'Type="Software"' it does - but sometimes gets things I don't want.

    John Jensen, Applications Specialist

    University of Auckland Business School


    jj John Thayer Jensen, System Administrator, Digital Services, The University of Auckland Business School Room 260-4136, 12 Grafton Road DDI: +64 9 923-7543 Mobile (work): +64 21 83-3586 Mobile (personal): +64 21 85-1904 quickdial: 60001 FAX: +64 9 373-7696 http://inquietumcor.blogspot.com

    Tuesday, September 19, 2017 9:48 PM

Answers

  • I did post the question on https://gallery.technet.microsoft.com/scriptcenter/Execute-Windows-Update-fc6acb16/view/Discussions, which is where the author of the script posted it. I did this two weeks ago. I don't know what the proper way to find an answer is. You said to ask the author of the script but the only way I know how is to post on the page where he posted the script.

    That's the correct place. There's no SLA that requires the author to answer your question either on that page or in this forum.

    If you are familiar with PowerShell, you can use the author's sample and make the needed changes to give the behavior you want. For example, if the update searcher object doesn't provide the search capability you want, then you will need to retrieve all updates and then filter after-the-fact.


    -- Bill Stewart [Bill_Stewart]

    Wednesday, September 20, 2017 2:46 PM

All replies

  • 1. You didn't ask a question. (A complaint about how something doesn't behave the way you want it to is not the same as a question.)

    2. We didn't write the script, so you should ask the author of the script your question.


    -- Bill Stewart [Bill_Stewart]

    Tuesday, September 19, 2017 9:51 PM
  • I beg your pardon.  I thought the question was implicit in the complaint.  How do I make the script apply only those types of updates (critical and cumulative)?

    I did post the question on https://gallery.technet.microsoft.com/scriptcenter/Execute-Windows-Update-fc6acb16/view/Discussions, which is where the author of the script posted it.  I did this two weeks ago.  I don't know what the proper way to find an answer is.  You said to ask the author of the script but the only way I know how is to post on the page where he posted the script.

    Sorry that I don't quite know the proper way to do this - I was hoping the author of the script would reply.  The author is named 'Monimoy Sanyal.'

    jj


    jj John Thayer Jensen, System Administrator, Digital Services, The University of Auckland Business School Room 260-4136, 12 Grafton Road DDI: +64 9 923-7543 Mobile (work): +64 21 83-3586 Mobile (personal): +64 21 85-1904 quickdial: 60001 FAX: +64 9 373-7696 http://inquietumcor.blogspot.com

    Wednesday, September 20, 2017 12:52 AM
  • To get what you ask would require a full re-write of Michael's module or ... you could learn PowerShell and use it to parse the result for only the KB's asked as "Critical" and "Cumulative".  There is no trivial answer.

    Unfortunately this is a technical forum and not really for end users who require assistance. I suggest starting by reading the documentation on how updates work and how to use the Windows Update objects to retrieve the updates.

    You will find that there is no specific way to tell the type of an update. The closest you can get is this:

    Get-WUHistory | Where{ $_.Title -match 'Cumulative'}


    \_(ツ)_/

    Wednesday, September 20, 2017 1:15 AM
  • Thanks - no, I do know Powershell quite well.  The problem is not Powershell; it's with the Microsoft COM object Microsoft.Update.Searcher, which is inadequately documented.  The Microsoft.Update.Searcher.Search method takes a string value of 'Type' but there is no list I have been able to find of valid types.  When I try putting in 'Critical' or 'Critical Update', or 'Cumulative' or 'Cumulative Update,' it finds nothing, even although if I put 'Software' it finds them.

    I have a lot of reading but haven't found the answer.  'Get-WUHistory' gives quite expanded names, like 'Cumulative Update for Windows 10 Version 1703 for x64-based Systems'.  I'm trying to automate updates for a fleet of a couple of thousand PCs with Windows 7 and a variety of versions of Windows 10.

    Thanks for your response.  I'm afraid I have been unclear.  I am a fairly proficient Powershell scripter; the question is about the Windows update COM class.  I don't know if there is another forum I could use for this - perhaps not.

    jj


    jj John Thayer Jensen, System Administrator, Digital Services, The University of Auckland Business School Room 260-4136, 12 Grafton Road DDI: +64 9 923-7543 Mobile (work): +64 21 83-3586 Mobile (personal): +64 21 85-1904 quickdial: 60001 FAX: +64 9 373-7696 http://inquietumcor.blogspot.com

    Wednesday, September 20, 2017 2:04 AM
  • PS - part of the problem is that Search method allows only = and != for Type - no 'like' or similar.  The only documentation I can find is:

    https://msdn.microsoft.com/en-us/library/windows/desktop/aa386526(v=vs.85).aspx

    jj


    jj John Thayer Jensen, System Administrator, Digital Services, The University of Auckland Business School Room 260-4136, 12 Grafton Road DDI: +64 9 923-7543 Mobile (work): +64 21 83-3586 Mobile (personal): +64 21 85-1904 quickdial: 60001 FAX: +64 9 373-7696 http://inquietumcor.blogspot.com

    Wednesday, September 20, 2017 2:07 AM
  • Yes, and your suggestion is the best I will be able to do - get all the updates and then parse their names.  I had hoped to get the searcher to do it for me.

    jj


    jj John Thayer Jensen, System Administrator, Digital Services, The University of Auckland Business School Room 260-4136, 12 Grafton Road DDI: +64 9 923-7543 Mobile (work): +64 21 83-3586 Mobile (personal): +64 21 85-1904 quickdial: 60001 FAX: +64 9 373-7696 http://inquietumcor.blogspot.com

    Wednesday, September 20, 2017 2:20 AM
  • Thanks - no, I do know Powershell quite well.  The problem is not Powershell; it's with the Microsoft COM object Microsoft.Update.Searcher, which is inadequately documented.  The Microsoft.Update.Searcher.Search method takes a string value of 'Type' but there is no list I have been able to find of valid types.  When I try putting in 'Critical' or 'Critical Update', or 'Cumulative' or 'Cumulative Update,' it finds nothing, even although if I put 'Software' it finds them.

    I have a lot of reading but haven't found the answer.  'Get-WUHistory' gives quite expanded names, like 'Cumulative Update for Windows 10 Version 1703 for x64-based Systems'.  I'm trying to automate updates for a fleet of a couple of thousand PCs with Windows 7 and a variety of versions of Windows 10.

    Thanks for your response.  I'm afraid I have been unclear.  I am a fairly proficient Powershell scripter; the question is about the Windows update COM class.  I don't know if there is another forum I could use for this - perhaps not.

    jj


    jj John Thayer Jensen, System Administrator, Digital Services, The University of Auckland Business School Room 260-4136, 12 Grafton Road DDI: +64 9 923-7543 Mobile (work): +64 21 83-3586 Mobile (personal): +64 21 85-1904 quickdial: 60001 FAX: +64 9 373-7696 http://inquietumcor.blogspot.com

    It is all well documented and summarized in the PSWindowsUpdate module.  Since you are so good with PowerShell then just look at the code in the module and you will see nearly everything there and explained.

    Here are ALL of the definitions for the "Searcher.Search" method: https://msdn.microsoft.com/en-us/library/windows/desktop/aa386526(v=vs.85).aspx

    Knowing some bits of PowerShell does not help when it comes to non-PowerShell subsytems.  You must do the research.  This is generally nearly impossible for those who are not technically trained and/or certified in Windows technologies.  Windows I probably the largest single piece of software on the planet.  All developers know that it takes constant study to use effectively.

    Your question tells me that you do not know PowerShell or you would have used the code I posted after doing some research to learn how updates work. Most of this research can be done by analyzing the objects returned by the searcher.  PowerShell has numerous tools to help you analyze types and look up the documentation. Those who have never formally takin a course, a book or tutorial never learn any of these basic PowerShell capabilities.

    Yes the issue is the COM object. You have not looked it up in the developer docs. It is documented in exquisite detail. How could you expect developers to have used it successfully for nearly 15 years. It is part of the code of many MS products and used by hundreds of third party products.


    \_(ツ)_/

    Wednesday, September 20, 2017 2:27 AM
  • PS - part of the problem is that Search method allows only = and != for Type - no 'like' or similar.  The only documentation I can find is:

    https://msdn.microsoft.com/en-us/library/windows/desktop/aa386526(v=vs.85).aspx

    jj


    jj John Thayer Jensen, System Administrator, Digital Services, The University of Auckland Business School Room 260-4136, 12 Grafton Road DDI: +64 9 923-7543 Mobile (work): +64 21 83-3586 Mobile (personal): +64 21 85-1904 quickdial: 60001 FAX: +64 9 373-7696 http://inquietumcor.blogspot.com

    Yes - that is all we need.  The remaining items are part of the download and are specific to the download.  You need to learn how to use WU.  History objects and "needed" objects have different schemas.  Analyze the objects.

    Note that the online links are embedded in the downloaded objects.


    \_(ツ)_/

    Wednesday, September 20, 2017 2:30 AM
  • I did post the question on https://gallery.technet.microsoft.com/scriptcenter/Execute-Windows-Update-fc6acb16/view/Discussions, which is where the author of the script posted it. I did this two weeks ago. I don't know what the proper way to find an answer is. You said to ask the author of the script but the only way I know how is to post on the page where he posted the script.

    That's the correct place. There's no SLA that requires the author to answer your question either on that page or in this forum.

    If you are familiar with PowerShell, you can use the author's sample and make the needed changes to give the behavior you want. For example, if the update searcher object doesn't provide the search capability you want, then you will need to retrieve all updates and then filter after-the-fact.


    -- Bill Stewart [Bill_Stewart]

    Wednesday, September 20, 2017 2:46 PM