Oct 18

vSphere 6.5 PowerCLI Module for Encrypted vMotion Management

If you haven’t seen my post on Encrypted vMotions already, click HERE to read about it.

PowerCLI Module for Encrypted vMotion

Last week as I was thinking about our new Encrypted vMotion feature, I thought “I wonder how we can consume this data at scale?” and ‘at scale’ for me meant anything greater than 5 VM’s, all the way up into the 1000’s. The PowerCLI portion of my brain kicked in and I began digging around in the API to see if I could find this property. With a little effort I was able to find it and create two functions: Get-vMotionEncryptionConfig and Set-vMotionEncryptionConfig. Both of these are very easy to use.

Get-vMotionEncryptionConfig only requires that the object being passed is a Virtual Machine object. This means either saving the VM’s you want to report on as a variable: $VM = Get-VM <VM Name(s)> or adding the Get-VM cmdlet directly into the function: Get-vMotionEncryptionConfig -VM (Get-VM <VM Name(s)>.

get-encryptedvmotionThis is what your output will look like. It will include the VM Name and the vMotion Encryption setting. Very straight-forward.


Using the Set-vMotionEncryptionConfig function is exactly the same as the previous cmdlet except there is an additional parameter ‘-Encryption’. If you type the parameter name (or tab-complete the parameter name), the function is setup to allow you to then ‘TAB’ through the available values: ‘disabled’, ‘opportunistic’, and ‘required’

If you wanted to set all of your VMs to opportunistic, you would write something like:





You can grab the module directly from GitHub here: https://github.com/vtagion/Scripts/blob/master/EncryptedvMotion.psm1

Or you can grab the static version below. Note*: If I update this module on GitHub I will probably not update it here. It’s best to go the GitHub route.




  1. Neil Anderson

    Thanks very much for dropping all this top new 6.5 content, Brian. I think you’ve earned yourself a rest 😉

  2. Alberto Villegas

    Hi Brian, without the chance to test this functions… could there be an error in the process section of the Get function? (line 38 in GitHub)

    Get-VM | select Name, @{name=”vMotionEncryption”;Expression={$_.extensiondata.config.MigrateEncryption}}

    instead of:

    $VM | select Name, @{name=”vMotionEncryption”;Expression={$_.extensiondata.config.MigrateEncryption}}

    Thanks a lot for all the great content from the last days.

    1. Brian Graf

      Thanks for the catch Alberto! I guess i’m bound to mess up when I’m spitting all of this content out relatively quickly 🙂 I’ve updated the script at the bottom of the page as well as updated the function on Github.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

7 + 19 =