From 7a5ae91379309c643985129c1132b8e86367876a Mon Sep 17 00:00:00 2001 From: baoyinqiao Date: Wed, 14 Dec 2016 08:57:43 +0800 Subject: [PATCH 1/2] Add a new VIProperty: KMSserver for VM As Mike suggested, add a new VI Property to retrieve the KMSserver ClusterId for encrypted VMs. --- Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 b/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 index 149fd49..f14973a 100644 --- a/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 +++ b/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 @@ -59,6 +59,13 @@ New-VIProperty -Name Locked -ObjectType VirtualMachine -Value { ($vm.extensiondata.Runtime.ConnectionState -eq "invalid") -and ($vm.extensiondata.Config.KeyId) } -BasedOnExtensionProperty 'Runtime.ConnectionState','Config.KeyId' -Force | Out-Null +New-VIProperty -Name KMSserver -ObjectType VirtualMachine -Value { + Param ($VM) + if ($VM.Encrypted) { + $VM.EncryptionKeyId.ProviderId.Id + } + } -BasedOnExtensionProperty 'Config.KeyId' -Force | Out-Null + New-VIProperty -Name Encrypted -ObjectType HardDisk -Value { Param ($hardDisk) $hardDisk.ExtensionData.Backing.KeyId -ne $null From 9f8d094e387566a4d90f37bad4b37276a57f3718 Mon Sep 17 00:00:00 2001 From: baoyinqiao Date: Wed, 14 Dec 2016 09:02:47 +0800 Subject: [PATCH 2/2] Fix the indentation of Encrypted Property of disk Identation fix. --- Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 b/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 index f14973a..8594bf9 100644 --- a/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 +++ b/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 @@ -67,8 +67,8 @@ New-VIProperty -Name KMSserver -ObjectType VirtualMachine -Value { } -BasedOnExtensionProperty 'Config.KeyId' -Force | Out-Null New-VIProperty -Name Encrypted -ObjectType HardDisk -Value { - Param ($hardDisk) - $hardDisk.ExtensionData.Backing.KeyId -ne $null + Param ($hardDisk) + $hardDisk.ExtensionData.Backing.KeyId -ne $null } -BasedOnExtensionProperty 'Backing.KeyId' -Force | Out-Null New-VIProperty -Name EncryptionKeyId -ObjectType HardDisk -Value {