Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter windows updates doesn't work for WS2012 #108

Open
tempora-mutantur opened this issue Nov 16, 2021 · 1 comment
Open

Filter windows updates doesn't work for WS2012 #108

tempora-mutantur opened this issue Nov 16, 2021 · 1 comment

Comments

@tempora-mutantur
Copy link

Hi.

Using the following configuration:

  provisioner "windows-update" {
    search_criteria = "IsInstalled=0"
    filters = [
      "exclude:$_.Title -like '*Preview*'",
      "include:$true",
    ]
    update_limit = 25
  }

It fails with the following error

11:04:53 vsphere-clone.updates: ERROR: Element not found. (Exception from HRESULT: 0x80070490)
11:04:53 vsphere-clone.updates: ERROR: at , C:\Windows\Temp\packer-windows-update-elevated.ps1: line 60
11:04:53 vsphere-clone.updates: ERROR EXCEPTION: System.Runtime.InteropServices.COMException (0x80070490): Element not found. (Exception from HRESULT: 0x80070490)
11:04:53 vsphere-clone.updates: ERROR EXCEPTION: at System.Management.Automation.ComInterop.ComRuntimeHelpers.CheckThrowException(Int32 hresult, ExcepInfo& excepInfo, ComMethodDesc method, Object[] args, UInt32 argErr)
11:04:53 vsphere-clone.updates: ERROR EXCEPTION: at CallSite.Target(Closure , CallSite , ComObject , Object )
11:04:53 vsphere-clone.updates: ERROR EXCEPTION: at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
11:04:53 vsphere-clone.updates: ERROR EXCEPTION: at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
11:04:53 vsphere-clone.updates: ERROR EXCEPTION: at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
11:04:53 vsphere-clone.updates: ERROR EXCEPTION: at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
11:04:59 vsphere-clone.updates: ERROR: Element not found. (Exception from HRESULT: 0x80070490)

The same passes on WS2016

Thanks.

@rgl
Copy link
Owner

rgl commented Nov 18, 2021

It seems the scheduled task was not returned from the API for some reason at https://github.com/rgl/packer-plugin-windows-update/blob/master/update/elevated-template.ps1#L60. But I have no idea why.

BTW, this was only tested with 2012R2. Maybe something needs to be changed to work with 2012, but I will not even try to do that, as that windows version is too old.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants