Zachary Loeber

The personal website of Zachary Loeber.

VMware: Migrating a vCenter virtual appliance to a vCenter Windows server

I finally bit the bullet and migrated my lab from a vCenter virtual appliance to a vCenter Windows server. This is what I did to maintain all my settings and not disrupt any currently running VMs.

  1. Download InventorySnapshot to a workstation or your new VCenter server (as long as the vmware powerCLI and Java 1.5 is installed).

    1. Run the run.bat file to start InventorySnapshot
    2. Put in the IP or hostname of your old VMware appliance as well as the credentials and a good place to drop the resulting snapshot, select to “Take Snapshot”InvSnap
    3. A new window will come up with a few tabs that looks like this:InvSnap2
    4. Don’t worry about the host passwords, just make sure everything is selected in the Inventory Tree tab and then select the Generate PowerCLI code in the last tab.
    5. Copy all the output from the folder you specified earlier to the new vCenter server.
    6. Open a VMware vSphere PowerCLI window and run the following to connect locally:
      Set-ExecutionPolicy RemoteSigned

    Connect-VIServer localhost
    1. Open the createInventory.ps1 file then copy and paste everything above the line that states, “# ### START ADDHOSTS CLUSTER”
    2. At this point you have the basic cluster setup but not much else. I was unable to get the hosts to automatically add. To get around this I just manually added them (kinda stole them from the vCenter virtual appliance). So open up a vSphere client and connect to your new vCenter server, right0click on your cluster and select to add a host. Proceed to add all the hosts in your cluster. (Note: You will get warnings about duplicating configurations and causing issues with the old vCenter server, that is ok, just select Yes and move on as all host configuration for networking and storage will be maintained and no outage for currently running VMs will occur).
    3. By the time you have gotten to this point your old VMware appliance will show all hosts and VMs as disconnected and your new vCenter server will have all the goods.InvSnap3
    4. But what about everything else? Luckily enough, most networking and other host settings carry over so your VMs should have stayed live this entire time.  But if you had DRS or host affinities setup there is more you can do to automate the flip to your new server. Go back into that createInventory.ps1 file and comment out (with #) the first several lines of the script which creates the cluster and adds the hosts. It will look something like this when you are done (minus the rest of the script, just leave all that other stuff alone).
      # ### START RESTORE DC: Datacenter

    # ### START CREATE DC: Datacenter
    # Create DC: Datacenter in folder: null
    $parentFolder = Get-Folder -NoRecursion
    #New-Datacenter -Location $parentFolder -name "Datacenter"
    # ### END CREATE DC: Datacenter
    # ### START RESTORE CLUSTER: Cluster1
    # ### START CREATE_CLUSTER_IN FOLDER: host
    # ### START CREATE CLUSTER: Cluster1
    # Create cluster: Cluster1 in datacenter Datacenter
    # parent folder of cluster Cluster1 host
    # Finding Parent Folder. Path: //Datacenter/host
    $si = Get-View -id "SearchIndex-SearchIndex"
    $parentChain = "//Datacenter/host"
    $parentFolderId = $si.FindByInventoryPath($parentChain)
    $parentFolder = Get-Folder -id $parentFolderId
    #New-Cluster -Location $parentFolder -Name "Cluster1"
    # ### END CREATE CLUSTER: Cluster1
    # ### END CREATE_CLUSTER_IN FOLDER: host
    # ### START ADDHOSTS CLUSTER: Cluster1
    $cluster = Get-Cluster -location (get-datacenter -name "Datacenter") -name "Cluster1"
    # Adding host 192.168.1.250 to cluster "Cluster1"
    #Add-VMHost 192.168.1.250 -Location $cluster -user root -password 'PASSWORD' -Force
    # Adding host 192.168.1.251 to cluster "Cluster1"
    #Add-VMHost 192.168.1.251 -Location $cluster -user root -password 'PASSWORD' –Force
    1. Then save and run the script in the already open VMware PowerCLI window. You may get a few errors or warnings but it should complete. When this is done all of your old settings should have migrated over without much fanfare.
comments powered by Disqus