1 2 Previous Next 22 Replies Latest reply on Nov 25, 2019 8:30 AM by padulka

    OVFTool through Powercli

    padulka Enthusiast

      Hi to all, Now I'm deployng a new VM from ovftool connecting with ssh to host and executing the following command: ./ovftool --X:logFile=upload.log --X:logLevel=verbose --noSSLVerify --skipManifestCheck --name="VM_Name" /vmfs/volumes/localdatastore/OVF/master.ovf vi://root:!password@127.0.0.1 I would like to use the same procedure through powercli, is it possibile? NB: I have to execute locally due to connection speed. Regards Federico

      VCAP-DCV
      VCAP-NV
      VCIX-NV
        • 1. Re: OVFTool through Powercli
          LucD Guru
          User ModeratorsCommunity WarriorsvExpert

          You can do the same with Import-VApp.

          • 2. Re: OVFTool through Powercli
            padulka Enthusiast

            Thanks LucD, I have found your post but now is unreachable where you reply to use the following varible to poin to local datastore:

             

            $fileName = '[MyDatastore] folder/master.ovf'

            $dsName,$filePath = $fileName.Split(']')

            $dsName = $dsName.TrimStart('[')

            $filePath = $filePath.TrimStart(' ')

            $ds = Get-Datastore -Name $dsName

            $dcPath = $ds.DatastoreBrowserPath.Split('@')[1].TrimStart('443\').Trimend("\$($dsName)").Replace('\','/')

            $url1 = "$($global:DefaultVIServer.ServiceUri.OriginalString.TrimEnd('/sdk'))"

            $url2 = "$($filePath)"

            $url3 = "dcPath=$($dcPath)"

            $url4 = "dsName=$($dsName)"

            $url = "$($url1)/$($url2)?$($url3)&$($url4)" $url

             

            On variable $fileName = '[MyDatastore] folder/master.ovf' how can I insert my local datastore?

             

            I try to use:

             

            $vmHosts = Get-VMHost -name $MyHost
            $datastore = Get-VMHost $MyHost | Get-Datastore
            $datastorename = $datastore.name

             

            but don't know to insert in your variable.

             

            Thanks

             

             

            VCAP-DCV
            VCAP-NV
            VCIX-NV
            • 3. Re: OVFTool through Powercli
              LucD Guru
              vExpertUser ModeratorsCommunity Warriors

              Which post is unreachable?

               

               

              The $fileName variable contains the location of the OVA file on one of your datastores.

              In

              $fileName = '[MyDatastore] folder/master.ovf'

              you need to replace the MyDatastore with the name of your datastore.

              Then the folder/master.ovf or folder/master.ova is the path on that datastore where the OVF or OVA resides.

               

              Where did you upload the OVA file?

              • 4. Re: OVFTool through Powercli
                padulka Enthusiast

                I have the ovf file locally and I need to deploy it locally.

                 

                But I have to repeat as request to a lot of different hosts. This is the aim to avoid to use ssh on each host and user a powercli script and connect to vcenter to manage, when requested, the deploy

                 

                 

                 

                 

                VCAP-DCV
                VCAP-NV
                VCIX-NV
                • 5. Re: OVFTool through Powercli
                  LucD Guru
                  vExpertCommunity WarriorsUser Moderators

                  What do you mean by "locally"?
                  On your PC?

                   

                  In that case, have a look at Example 1 of the Import-VApp cmdlet.

                  • 6. Re: OVFTool through Powercli
                    padulka Enthusiast

                    Sorry you have right. On the unique local datastore of the host

                    VCAP-DCV
                    VCAP-NV
                    VCIX-NV
                    • 7. Re: OVFTool through Powercli
                      LucD Guru
                      vExpertCommunity WarriorsUser Moderators

                      What script of mine are you using (the one you said earlier that you can't access)?

                      • 8. Re: OVFTool through Powercli
                        padulka Enthusiast

                        Now I'm using ssh on the host an then ./ovftool --X:logFile=upload.log --X:logLevel=verbose --noSSLVerify --skipManifestCheck --name="VM_Name" /vmfs/volumes/localdatastore/OVF/master.ovf vi://root:!password@127.0.0.1 I would like to use powercli, connect to vcenter and then, as you have told me, use import-vapp; ma now I need to convert ovftool commad to import-vapp

                        VCAP-DCV
                        VCAP-NV
                        VCIX-NV
                        • 9. Re: OVFTool through Powercli
                          LucD Guru
                          User ModeratorsvExpertCommunity Warriors

                          I mean which post are you referring to?

                          Thanks LucD, I have found your post but now is unreachable where you reply to use the following varible to poin to local datastore:

                          You can install the OVA from a folder on your PC or from a location on a datastore.

                          Which one do you want to use?

                          • 10. Re: OVFTool through Powercli
                            padulka Enthusiast

                            this post: https://code.vmware.com/forums/2530/vsphere-powercli#538119 from location on a datastore

                            VCAP-DCV
                            VCAP-NV
                            VCIX-NV
                            • 11. Re: OVFTool through Powercli
                              LucD Guru
                              User ModeratorsvExpertCommunity Warriors

                              Ok, that is describing a method to construct the URI to be used when the OVA is sitting on a datastore.

                               

                              There is a known limitation when you are connected to an ESXi node instead of a vCenter.
                              See Import-vApp still busted in 11.4?

                               

                              If you are connected to the vCenter, and have the OVA sitting on a local drive on your PC, you should be able to use Import-VApp.
                              Are any of these requirements not possible for you?
                              Which one?

                              • 12. Re: OVFTool through Powercli
                                padulka Enthusiast

                                I cannot use my pc due to speed connection on remote host. I will check you link thanks

                                VCAP-DCV
                                VCAP-NV
                                VCIX-NV
                                • 13. Re: OVFTool through Powercli
                                  LucD Guru
                                  User ModeratorsCommunity WarriorsvExpert

                                  It would also help if you could list the requirements and restrictions for deploying a VM through an OVA in your environment.
                                  So far I gathered from your replies:

                                   

                                  • the OVA can not be uploaded from your PC due to bandwidth restrictions
                                  • you need to deploy the OVA to one or more ESXi nodes

                                   

                                  Some questions on that.

                                   

                                  • are you connected to a vCenter?
                                  • do these ESXi nodes have shared storage available?
                                  • are the ESXi nodes part of a cluster, or are they standalone nodes?
                                  • 14. Re: OVFTool through Powercli
                                    padulka Enthusiast

                                    I have all hosts standalone managed from one vCenter. Every host has already copied on local datastore the ovf file. Now I need to connect to every host through SSH to deploy a new VM and I would to write an interactive powercli script to centralize the execution.

                                    VCAP-DCV
                                    VCAP-NV
                                    VCIX-NV
                                    1 2 Previous Next