3 Replies Latest reply on Sep 14, 2018 8:55 AM by LucD

    VUM - newpatchbaseline targettype

    gjbrown Novice

      Hi I am trying to create a new patchbaseline running the following

       

      $patch = Get-Patch -SearchPhrase "ESXi600-201711101-SG"

      New-PatchBaseline -Server myvirtualcenter   -Name CVE-2017-5753_CVE-2017-5753_CVE-2017-5754 -Static -IncludePatch $patch -TargetType Host

       

      but I get the error

      "

      WARNING: Parameter 'TargetType' is obsolete. The TargetType parameter is deprecated and will be removed in a following release. The only acceptable value is 'Host'.

      New-PatchBaseline : Unable to cast object of type 'VMware.VimAutomation.ViCore.Util10.Surrogate.DefaultValue.StringWrapperVIServer' to type 'VMware.VimAutomation.ViCore.Interop.V1.VIObjectCoreInterop'.

      At line:2 char:1

      + New-PatchBaseline -Server myvc-emea   -Name CVE-2017-5753_CVE-2017-57 ...

      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

          + CategoryInfo          : NotSpecified: (:) [New-PatchBaseline], InvalidCastException

          + FullyQualifiedErrorId : System.InvalidCastException,VMware.VumAutomation.Commands.NewPatchBaseline

       

      "

       

      I have tried without -TargetType or without host and get other errors.

      Can someone help me?

        • 1. Re: VUM - newpatchbaseline targettype
          LucD Guru
          User ModeratorsvExpertCommunity Warriors

          The TargetType message is a warning, that's not where the cmdlet fails.

          It's on the Server parameter

          Try like this

           

          $patch = Get-Patch -SearchPhrase "ESXi600-201711101-SG"

          New-PatchBaseline -Server $global:DefaultVIServer -Name CVE-2017-5753_CVE-2017-5753_CVE-2017-5754 -Static -IncludePatch $patch -TargetType Host

           

          • 2. Re: VUM - newpatchbaseline targettype
            gjbrown Novice

            Thank you, this helped alot, but of course I am now stuck at the next error.  I have verified through VUM, that the patches do exist on it.

             

            New-PatchBaseline : Some of the patches are not found on the specified server.

            At line:3 char:1

            + New-PatchBaseline -Server $global:DefaultVIServer  -Name CVE-2017-575 ...

            + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                + CategoryInfo          : NotSpecified: (:) [New-PatchBaseline], VimException

                + FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.VimException,VMware.VumAutomation.Commands.NewPatchBaseline

            • 3. Re: VUM - newpatchbaseline targettype
              LucD Guru
              vExpertCommunity WarriorsUser Moderators

              I suspect that you are connected to multiple vCenters (check $global:defaultviservers).

              The patch might have been found on one vCenter, which is not the last vCenter you connected to (which is what $global:defaultviserver represents).

              You can also try leaving out the Server parameter altogether.