VMware Cloud Community
gjbrown
Enthusiast
Enthusiast

VUM - newpatchbaseline targettype

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?

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
gjbrown
Enthusiast
Enthusiast

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

Reply
0 Kudos
LucD
Leadership
Leadership

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.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos