PowerCLI

Expand all | Collapse all

Attach-baseline failing with error

  • 1.  Attach-baseline failing with error

    Posted Apr 10, 2015 09:22 AM

    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



  • 2.  RE: Attach-baseline failing with error

    Posted Apr 10, 2015 09:29 AM

    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



  • 3.  RE: Attach-baseline failing with error

    Posted Apr 10, 2015 10:40 AM

    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.



  • 4.  RE: Attach-baseline failing with error

    Posted Apr 10, 2015 10:51 AM

    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



  • 5.  RE: Attach-baseline failing with error

    Posted Apr 10, 2015 10:54 AM

    Is this returning a baseline object ?

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



  • 6.  RE: Attach-baseline failing with error

    Posted Apr 10, 2015 12:46 PM

    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



  • 7.  RE: Attach-baseline failing with error

    Posted Apr 10, 2015 12:52 PM

    Then try this variation

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

    Attach-Baseline -Baseline $baseline -Entity $ESXHOST 



  • 8.  RE: Attach-baseline failing with error

    Posted Apr 10, 2015 01:07 PM

    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



  • 9.  RE: Attach-baseline failing with error
    Best Answer

    Posted Apr 10, 2015 01:11 PM

    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 ?



  • 10.  RE: Attach-baseline failing with error

    Posted Apr 10, 2015 03:59 PM

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

    Thanks for all your help.



  • 11.  RE: Attach-baseline failing with error

    Posted Apr 14, 2015 02:36 PM

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