diff --git a/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 b/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 index 57734cf..d46d63b 100644 --- a/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 +++ b/Modules/VMware.VMEncryption/VMware.VMEncryption.psm1 @@ -81,6 +81,13 @@ New-VIProperty -Name Encrypted -ObjectType HardDisk -Value { $hardDisk.ExtensionData.Backing.KeyId -ne $null } -BasedOnExtensionProperty 'Backing.KeyId' -Force | Out-Null +New-VIProperty -Name KMSserver -ObjectType VMHost -Value { + Param ($VMHost) + if ($VMHost.CryptoSafe) { + $VMHost.ExtensionData.Runtime.CryptoKeyId.ProviderId.Id + } +} -BasedOnExtensionProperty 'Runtime.CryptoKeyId.ProviderId.Id' -Force | Out-Null + New-VIProperty -Name EncryptionKeyId -ObjectType HardDisk -Value { Param ($Disk) if ($Disk.Encrypted) { @@ -976,7 +983,7 @@ Function Set-VMDiskEncryptionKey { C:\PS>$KMSCluster = Get-KMSCluster | select -last 1 C:\PS>$VM = Get-VM -Name win2012 C:\PS>$HardDisk = get-vm $vm|Get-HardDisk - C:\PS>$HardDisk|$Set-VMEncryptionKey -VM $VM -KMSClusterId $KMSCluster.Id -Deep + C:\PS>$HardDisk|Set-VMDiskEncryptionKey -VM $VM -KMSClusterId $KMSCluster.Id -Deep Deep rekeys all the disks of the $VM using a new key. The key is generated from the KMS whose clusterId is $KMSCluster.Id. @@ -1681,7 +1688,7 @@ Function Get-KMServerStatus { [String] $KMSClusterId ) - Begin { + Begin { # Confirm the connected VIServer is vCenter Server ConfirmIsVCenter