Skip to content

ESXi version update on a given host - govmomi call to support updates #3147

Answered by dougm
SaleemHP asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you can use the same API that govc/host/esxcli.go uses, for example:

		m := view.NewManager(c)
		kind := []string{"HostSystem"}

		v, err := m.CreateContainerView(ctx, c.ServiceContent.RootFolder, kind, true)
		if err != nil {
			return err
		}

		hosts, err := v.Find(ctx, kind, property.Filter{})
		if err != nil {
			return err
		}

		for _, ref := range hosts {
			host := object.NewHostSystem(c, ref)

			e, err := esxcli.NewExecutor(c, host)
			if err != nil {
				return err
			}

			res, err := e.Run([]string{"software", "profile", "update", "-d", "/vmfs/volumes/guid/vmware-depot.zip", "-p"})
			if err != nil {
				return err
			}

			for k, v := range res.Values[0] {
				fmt.Printf(

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dougm
Comment options

Answer selected by tenthirtyam
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants