2 Replies Latest reply on Sep 15, 2014 6:23 AM by jsmith77

    Template migration from one datastore to another

    jsmith77 Lurker

      Hi all,

         I am in the process of moving virtual infrastructure from one physical site to another.  The sites have a direct connection to each other.  My current task is to move our template repository from storage at the original site to storage at the new site.  The templates are all stored in one datastore that is an NFS share on Netapp storage.  I have already copied this datastore to a datastore in the new site.  My next step is to remove the templates from inventory that are located on the original site and add them into inventory from the new site.  I believe powercli would work great for this and I have loosely listed which commands I am using below.  I need to keep the templates in the folder structure found under the "VMs and Template" inventory view.

        Which would be better, to remove the templates from inventory and add them back in from the new location or adjust the template properties with set-template to point at the new location?

       

      $tm = Get-Template

      foreach ($template in $tm)

      {

      $ofl = $template.folderid   # ofl = original folder location

      remove-template and new-template?

      or

      set-template?

      }

        • 1. Re: Template migration from one datastore to another
          vNEX Expert

          Hi,

           

          you can also export your folder structure with these scripts mentioned here:

          Re: Export / Import selective Folder structure

          Re: Folder migration

           

          and then using Move-Template cmdlet move them to desired folder>

          Move-Template -Template <Temnplate name> -Destination <Folder name>

          or

          with Set-Template cmdlet convert your templates to VMs and  with Move-VM -VM <VM name> -Destination <Folder> cmdlet move VMs to desired folders...

          _________________________________________________________________________________________

          If you found this or any other answer helpful, please consider to award points. (use Correct or Helpful buttons)

          Regards,
          P.
          1 person found this helpful
          • 2. Re: Template migration from one datastore to another
            jsmith77 Lurker

            vNEX,   Thanks for the response.  Along with your response and a change in how we are migrating templates, I have found/created a script that will do the job.

             

            @Anyone else,

               Along with vNex's links, I found the following link helpful.  Creating a move-template function mentioned in the link helped complete a script that will do what I need it to.  Given that there is already a move-template in the current version of power-cli, I renamed the function so that I would not have any conflicts.  I also added a command to change the network adapter.

             

            PowerCLI: Move-Template | ICT-Freak.nl