vMotion between two vCenter Servers with different SSO domains

Last week i did my first vMotion between two vCenter Servers with different SSO domain by using PowerCLI. This functionality is also known as “cross vCenter vMotion” and is not included in the vSphere Web Client yet. Without downtime it’s possible to live migrate VMs from one vCenter Server to another. Cool stuff!

Before starting the following requirements must be met:

  • VMware vSphere 6.0 and later for the source and destination environment
  • PowerCLI 6.5 and later
  • vSphere Enterprise Plus license per ESXi host
  • An active connection to the source and destination  vCenter Server

I created a simple script to vMotion the VMs between the two SSO domains. See the more information section for more advanced PowerCLI scripts from for example William Lam and Romain Decker.

In the script the following variables must be defined:

  • Source vCenter Server, username and password
  • Destination vCenter Server, username and password
  • VM name will be moved
  • Destination vSwitch (this example is using a Standard vSwitch!)
  • Destination Portgroup
  • Destination datastore

Only VMs with one NIC are supported

PowerCLI example script

Import-Module VMware.PowerCLI

#Variables
$sourceVC = 'vc03'
$sourceVCUsername = 'ivobeerens@oracle.vsphere.local'
$sourceVCPassword= 'P@ssw0rd'

$destVC = 'vc01'
$destVCUsername = 'ivobeerens@vsphere.local'
$destVCpassword = 'P@ssword'
$destESXi = 'esx01.local'

$vmname = 'SRV121'
$Switchname = 'vSwitch2'
$NetworkName = 'vlan3114'
$datastorename = 'iaas-d029-05'

# Connect to the vCenter Servers
$sourceVCConn = Connect-VIServer -Server $sourceVC -user $sourceVCUsername -password $sourceVCPassword
$destVCConn = Connect-VIServer -Server $destVC -user $destVCUsername -password $destVCpassword

$vm = Get-VM $vmname -Server $sourceVCConn
$networkAdapter = Get-NetworkAdapter -VM $vm -Server $sourceVCConn

$destination = Get-VMHost -name $destESXi -Server $destVCConn
$destinationPortGroup = Get-VirtualPortGroup -VirtualSwitch $Switchname -name $NetworkName -VMHost $destination
$destinationDatastore = Get-Datastore -name $datastorename -Server $destVCConn

Move-VM -VM $vm -Destination $destination -NetworkAdapter $networkAdapter -PortGroup $destinationPortGroup -Datastore $destinationDatastore

With this script I migrated a couple of VMs between to vSphere 6.5 environment with different SSO domains without any downtime.

More information:

  • PowerCLI blog on the Move-VM cmdlet, link
  • William Lam, Automation Cross vCenter vMotion, link
  • Romain Decker Cross vMotion script from, link

What VMware Horizon View PowerCLI features you like to see?

PowerCLI 6.0 R1 is released with some cool new features. One thing I missed in this announcement is improvements in the PowerCLI support for VMware Horizon View. The latest release of VMware Horizon View 6.1 still has NO PowerCLI improvements! This is a huge bummer because PowerCLI is very limited in VMware Horizon View.

On the VMware PowerCLI Blog the following statement is written (link):
Each new release tends to have several features or enhancements that have been asked for by YOU, our customers. These new features come to us by way of interaction at events like VMworld, Partner Exchange, VMUG Conferences, Twitter, Email, and customer visits. What better way to show our customers that we listen then by adding in features they ask for? This release does not disappoint! Thank you to all who provide feedback and help us continue to improve this great tool.
So we must provide feature request feedback to the PowerCLI team to improve PowerCLI for VMware Horizon View!
I have the following feature requests:
  • Ability to run from remote systems
  • Creating and exporting desktop pools with all the settings available as in the GUI (Horizon View Administrator)
  • Available as module
  • Getting the Health overview as in the VMware Horizon View Administrator
  • Filter on the desktop status such as problem desktops, agent unreachable, deleting, missing, disconnected, available etc.
  • Filter pools and display the amount of desktops that are used, available desktops, headroom and total desktops.
  • Check the ADAM replication between the Connection Servers
  • Search and filter the Event database on error and warnings
  • Add or remove a VM to a manual pool
  • Send messages to desktops
Please let me know what features request you have by placing a comment in this blog post, even if it is already mention. All the feature requests will be bundled and forwarded to the PowerCLI team. I hope to see some of the feature requests in the next release of PowerCLI for VMware Horizon View.
Looking forward for your feature requests!

VIBSearch Finding VIB versions

VIBSearch is a simple PowerShell script with a GUI that will search for a specified VIB or all the VIBS installed on the ESXi hosts. A VIB stands for vSphere Installation Bundle (VIB). VIBs are used to package and distribute ESXi software such as drivers. The GUI is designed with SAPIEN PowerShell Studio 2014.

With VIBSearch it is easily to verify that all the ESXi host in the cluster have the same VIB versions installed. VIBSearch can be used for example to easily identify the HP-AMS driver version on all the ESXi hosts.

Requirements

VIBSearch is tested with:

  • PowerShell 4.0
  • PowerCLI 5.8 Release 1
  • For the Out-GridView cmdlet, PowerShell ISE is needed. Install ISE by using the following PowerShell commands:
    • Import-Module ServerManager
    • Add-WindowsFeature PowerShell-ISE

Installing and executing VIBSearch

  • Download VIBSearch.txt, link
  • Rename the *.txt  file to *.ps1
  • Open PowerShell and execute:
    • Set-ExecutionPolicy  unrestricted
    • ./vibsearch.ps1

After executing the script the following GUI appears:

0

  • To connect enter the FQDN or IP address of the vCenter name (1) and click on Connect (2) button

1

  • A credential window appear, enter the credentials for authenticating (administrator) to the vCenter Server. For a domain login use: user user@domainname  or domainname\username

5

  • After successfully authenticating to the vCenter Server there are two options to choose:
    • List All the VIBS:  List all the ESXi hosts in the vCenter Server
    • Search VIB: specify a VIB name for example “HP-AMS”

6

If authentication to the vCenter Server fails the following error is displayed in the PowerShell window:

authen

Example output:

HP-AMS VIB versions

hpams

Intel NIC VIB “net-igb” versions

Intel

NVIDIA VIB versions:

nvidia

Thanks to Francois-Xavier Cat (@LazyWinAdm) for helping me with the VIBSearch tool.