none
VBS: How to Install Updates manually from SCCM 2012 Client

    Question

  • Unfortunately, my organization has restricted use of PS. I have around 500 desktops where i need to ensure they are idle (I have certain criteria for this) and manually deploy patches during every patching cycle, i have written logic for verifying the computer status. I have below VBS so far for downloading and installing patches, this is returning either generic error or syntax error ('Invalid Parameter' or 'Type Mismatch') at line 10 in below code. Since i am clueless about what format 'InstallUpdates' method accepts in VBScript (I can try to cast the search result if i know the format):

    I have laready tried to pass 'colItems' by querying only 'UpdateID', 'BulletinID' and 'ArticleID' with no luck. Any help in this regard is highly appreciated.

    My VBScript: Set objWMIService = GetObject("winmgmts:\\.\root\ccm\ClientSDK") Set objInstall = GetObject("winmgmts:\\.\root\ccm\ClientSDK:CCM_SoftwareUpdatesManager") Set colItems = objWMIService.ExecQuery("SELECT * FROM CCM_SoftwareUpdate Where ComplianceState = 0") MsgBox colItems.Count Redim updatesList(colItems.Count) n = 0 For Each objItem In colItems n = n+1 UpdatesList(n-1) = objItem.UpdateID objInstall.InstallUpdates(UpdatesList) Next

    Tuesday, April 10, 2018 10:52 AM

All replies

  • In the script at https://gallery.technet.microsoft.com/scriptcenter/Install-All-Missing-8ffbd525#content, the argument list for InstallUpdates is an array of objects representing each missing update, not an array of ids.


    Jason | https://home.configmgrftw.com | @jasonsandys

    Tuesday, April 10, 2018 2:04 PM
    Moderator
  • Hi,

    Please refer to the following blog on How to install software updates using the client-side SDK:

    https://blogs.technet.microsoft.com/manageabilityguys/2012/08/31/how-to-install-software-updates-using-the-client-side-sdk/

    Best Regards,

    Lorry


    Please remember to mark the replies as answers if they help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Wednesday, April 11, 2018 4:15 AM
  • Dear Jason,

    Thank you for the clarification!

    I have tried to pass the query result directly to the InstallUpdates method, it returns me 'Generic Error'. In the below line of PS code, i have noticed that the objects array is casted before passing to InstallUpdates method, any idea how to do that in VBS?

    $MissingUpdatesReformatted = @($MissingUpdates | ForEach-Object {if($_.ComplianceState -eq 0){[WMI]$_.__PATH}})
    Wednesday, April 11, 2018 11:50 AM
  • Dear Lorry,

    I am failing at step 2: Stick the instances in an array (if they aren't already)

    Not sure how to do this in VBS

    Wednesday, April 11, 2018 11:52 AM
  • Hi,

    Sorry for delay replied.

    My appeal is also a PS script . If you want to use VB script to download and install updates, please refer to the following script:

    https://gallery.technet.microsoft.com/scriptcenter/VB-Script-to-Check-and-620579cd#content

    Best Regards,

    Lorry


    Please remember to mark the replies as answers if they help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, April 13, 2018 9:22 AM
  • Hi,

    You have not update for a long time. 

    Have you solved this problem? Can you share the solutions to help more people?

    Please remember to mark the replies as answer if they help.

    Best Regards,

    Lorry


    Please remember to mark the replies as answers if they help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, April 30, 2018 8:41 AM