sanjaygpt171
Enthusiast
Enthusiast

Enable Encrypted FT to required from Oppurtunistic

Jump to solution

@LucD 

I need to change Encrypted vmotion and Encrypted FT to "REQUIRED" from "Oppurtunistic"

I can change vmotion using below code but cannot change Encrypted FT.  Let me know, what we can add here 

 

$VMView = Get-VM  | Get-View
$Config = New-Object VMware.Vim.VirtualMachineConfigSpec
$Config.MigrateEncryption = New-Object VMware.Vim.VirtualMachineConfigSpecEncryptedVMotionModes
$Config.MigrateEncryption = "required"
$VMView.ReconfigVM($Config)

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

Try something like this.
Note this requires at least ESXi 7.0.2

$vm = Get-VM -Name 'Test'

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.MigrateEncryption = [vmware.vim.VirtualMachineConfigSpecEncryptedVMotionModes]::required  
$spec.FtEncryptionMode = [VMware.Vim.VirtualMachineConfigSpecEncryptedFtModes]::ftEncryptionRequired
$vm.ExtensionData.ReconfigVM_Task($spec)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

10 Replies
sanjaygpt171
Enthusiast
Enthusiast

@LucD Any help would be appreciated 

Tags (1)
0 Kudos
LucD
Leadership
Leadership

Try something like this.
Note this requires at least ESXi 7.0.2

$vm = Get-VM -Name 'Test'

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.MigrateEncryption = [vmware.vim.VirtualMachineConfigSpecEncryptedVMotionModes]::required  
$spec.FtEncryptionMode = [VMware.Vim.VirtualMachineConfigSpecEncryptedFtModes]::ftEncryptionRequired
$vm.ExtensionData.ReconfigVM_Task($spec)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

sanjaygpt171
Enthusiast
Enthusiast

@LucD getting below error with FT. Esxi version VMware ESXi, 7.0.2, 18538813

 

Unable to find type [VMware.Vim.VirtualMachineConfigSpecEncryptedFtModes].
At C:\encryptvmotion.ps1:5 char:26
+ ... ptionMode = [VMware.Vim.VirtualMachineConfigSpecEncryptedFtModes]::ft ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (VMware.Vim.Virt...ncryptedFtModes:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound

0 Kudos
LucD
Leadership
Leadership

Which PowerCLI version are you using?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
sanjaygpt171
Enthusiast
Enthusiast

@LucD Below are the details

PowerCLI Version
----------------
VMware PowerCLI 12.2.0 build 17538434

0 Kudos
LucD
Leadership
Leadership

Upgrade to 12.5, which has the correct framework for 7.0.2


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

sanjaygpt171
Enthusiast
Enthusiast

@LucD  Can we do it same from bash scripting. I am new to bash and not sure how to convert this script in bash. If you can convert it to bash , it will be very helpful. 

0 Kudos
LucD
Leadership
Leadership

Do you mean invoke PowerShell from a bash script?
That should work.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
sanjaygpt171
Enthusiast
Enthusiast

@LucD i don't won't to invoke powershell script from bash, i need to rewrite code in bash script

0 Kudos
LucD
Leadership
Leadership

Sorry, can't help you with that.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos