VMware Cloud Community
riyas1988
Enthusiast
Enthusiast
Jump to solution

Attach-baseline failing with error

Hi All,

I am trying to run below Powercli command for patching ESX host. When i run Attach-Baseline from the below query i am getting error. Please let me know if i am missing anything.

Get-Baseline | Select Name

Name : ESXi 5.1 U2 Build 1900470

Name : VA Upgrade to Latest (Predefined)

Name : VMware Tools Upgrade to Match Host (Predefined)

Name : VM Hardware Upgrade to Match Host (Predefined)

Name : Critical Host Patches (Predefined)

Name : Non-Critical Host Patches (Predefined)

Name : ESXi 5.1 Nezumi Baseline

Name : ESX 4.1 updates

Name : New Baseline

Name : ESXi5.1 Build 2000251

Name : ESXi 5.1 U3 Build 2323236

Command Executed:

Attach-Baseline -Baseline ESXi 5.1 U2 Build 1900470 -Entity ${ESXHOST}

Error Message

Attach-Baseline : Cannot bind parameter 'Baseline'. Cannot convert the "ESXi" value of type "System.String" to type "VMware.VumAutomation.Types.Baseline".

At line:5 char:26

+ Attach-Baseline -Baseline <<<<  ESXi 5.1 U2 Build 1900470 -Entity ${ESXHOST}

    + CategoryInfo          : InvalidArgument: (:) [Attach-Baseline], ParameterBindingException

    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,VMware.VumAutomation.Commands.AttachBaseline

Any help is appreciated.

Thanks and Regards

Riyas Hussain A

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Itlooks as if your account doesn't hold the privilege to attach baselines to this ESXi node.

Are you running this from an account that has the Administrator role on that entity ?


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

View solution in original post

0 Kudos
10 Replies
LucD
Leadership
Leadership
Jump to solution

Did you try like this ?

Get-Baseline -Name 'ESXi 5.1 U2 Build 1900470' |

Attach-Baseline -Entity $ESXHOST

The Attach-Baseline cmdlet expects a baseline object not a string


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

0 Kudos
riyas1988
Enthusiast
Enthusiast
Jump to solution

Hi,

Thanks for your reply. In my command ${ESXHOST} will be the variable which will contain the ESX host name.

If for example ESXHOST=test.test.com then the command will be replaced as Attach-Baseline -Baseline ESXi 5.1 U2 Build 1900470 -Entity test.test.com

Is the approach correct or do i need to make some changes during attach Baseline step?

I will also try your input and get back with the result.

0 Kudos
riyas1988
Enthusiast
Enthusiast
Jump to solution

Tried your suggestion.  Below the error message i got.

PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> Get-Baseline -Name 'ESXi 5.1 U2 Build 1900470' | Attach-Baseline -Entity test.test.com

Attach-Baseline : 4/10/2015 4:19:12 PM    Attach-Baseline        Cannot attach baseline 'ESXi 5.1 U2 Build 1900470'. The following error occured: 'fault.SecurityError.summary'

At line:1 char:65

+ Get-Baseline -Name 'ESXi 5.1 U2 Build 1900470' | Attach-Baseline <<<<  -Entity test.test.com

    + CategoryInfo          : InvalidArgument: (:) [Attach-Baseline], VimException

    + FullyQualifiedErrorId : FailedToAttachBaseline,VMware.VumAutomation.Commands.AttachBaseline

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Is this returning a baseline object ?

Get-Baseline -Name 'ESXi 5.1 U2 Build 1900470'


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

0 Kudos
riyas1988
Enthusiast
Enthusiast
Jump to solution

Yeah. Please find the below result.

PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> Get-Baseline -Name 'ESXi 5.1 U2 Build 1900470'

UpgradeRelease      : VMware.VumAutomation.Types.UpgradeReleaseImpl

UpgradeTo           :

Name                : ESXi 5.1 U2 Build 1900470

Description         :

LastUpdateTime      : 7/1/2014 12:46:35 PM

Id                  : 8

TargetType          : Host

BaselineContentType : Static

BaselineType        : Upgrade

IsSystemDefined     : False

TargetComponent     : HOST_GENERAL

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Then try this variation

$baseline = Get-Baseline -Name 'ESXi 5.1 U2 Build 1900470'

Attach-Baseline -Baseline $baseline -Entity $ESXHOST 


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

0 Kudos
riyas1988
Enthusiast
Enthusiast
Jump to solution

Tried below query but still having issue.

#Load the powerCLI snapin

Add-PSsnapin VMware.Vimautomation.core,VMware.VumAutomation

#Connect to the VCENTER HOST.

Connect-VIServer -Server vcenter -user "username" -password "password"

$baseline = Get-Baseline -Name 'ESXi 5.1 U2 Build 1900470'

Attach-Baseline -Baseline $baseline -Entity  host

#Close the Connection to VIServer

Disconnect-VIServer -Server vcenter -Confirm:$false

Attach-Baseline : 4/10/2015 9:02:56 AM    Attach-Baseline        Cannot attach baseline 'ESXi 5.1 U2 Build 1900470'. The following error occured: 'fault.SecurityError.summary'   

At line:6 char:16

+ Attach-Baseline <<<<  -Baseline $baseline -Entity  kdc3wesxrac002.kdc.capitalone.com

    + CategoryInfo          : InvalidArgument: (:) [Attach-Baseline], VimException

    + FullyQualifiedErrorId : FailedToAttachBaseline,VMware.VumAutomation.Commands.AttachBaseline

How can i defince the host name in the same script like $ESXHOST

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Itlooks as if your account doesn't hold the privilege to attach baselines to this ESXi node.

Are you running this from an account that has the Administrator role on that entity ?


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

0 Kudos
riyas1988
Enthusiast
Enthusiast
Jump to solution

Thanks LucD. I will check on the same and update you.

Thanks for all your help.

0 Kudos
riyas1988
Enthusiast
Enthusiast
Jump to solution

Thanks for all your support. Issue is identified as permission issue. We resolved it by providing appropriate permission.

0 Kudos