Merge pull request #188 from simonfangyingzhang/master
update VMware.VMEncryption for vSphere 6.7
This commit is contained in:
@@ -2,6 +2,31 @@ Prerequisites/Steps to use this module:
|
|||||||
|
|
||||||
1. This module only works for vSphere products that support VM Encryption. E.g. vSphere 6.5 and later.
|
1. This module only works for vSphere products that support VM Encryption. E.g. vSphere 6.5 and later.
|
||||||
2. All the functions in this module only work for KMIP Servers.
|
2. All the functions in this module only work for KMIP Servers.
|
||||||
3. Install the latest version of Powershell and PowerCLI(6.5).
|
3. Install the latest version of Powershell and PowerCLI.
|
||||||
4. Import this module by running: Import-Module -Name "location of this module"
|
4. Import this module by running: Import-Module -Name "location of this module"
|
||||||
5. Get-Command -Module "This module Name" to list all available functions.
|
5. Get-Command -Module "This module Name" to list all available functions.
|
||||||
|
|
||||||
|
Note:
|
||||||
|
Deprecating the below functions related to KMServer and KMSCluster from VMware.VMEncryption and using instead the ones from VMware.VimAutomation.Storage,
|
||||||
|
|
||||||
|
1, VMware.VMEncryption\Get-DefaultKMSCluster, use instead
|
||||||
|
VMware.VimAutomation.Storage\Get-KmsCluster|where {$_.UseAsDefaultKeyProvider}|foreach {$_.id}
|
||||||
|
|
||||||
|
2, VMware.VMEncryption\Get-KMSCluster, use instead
|
||||||
|
VMware.VimAutomation.Storage\Get-KmsCluster|select id
|
||||||
|
|
||||||
|
3, VMware.VMEncryption\Get-KMSClusterInfo, use instead
|
||||||
|
VMware.VimAutomation.Storage\Get-KmsCluster|foreach {$_.extensiondata}
|
||||||
|
|
||||||
|
4, VMware.VMEncryption\Get-KMServerInfo, use instead
|
||||||
|
VMware.VimAutomation.Storage\Get-KeyManagementServer|foreach {$_.extensiondata}
|
||||||
|
|
||||||
|
5, VMware.VMEncryption\New-KMServer, use instead
|
||||||
|
VMware.VimAutomation.Storage\Add-KeyManagementServer
|
||||||
|
|
||||||
|
6, VMware.VMEncryption\Remove-KMServer, use instead
|
||||||
|
VMware.VimAutomation.Storage\Remove-KeyManagementServer
|
||||||
|
|
||||||
|
7, VMware.VMEncryption\Set-DefaultKMSCluster, use instead
|
||||||
|
VMware.VimAutomation.Storage\Set-KmsCluster -UseAsDefaultKeyProvider
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
# Script Module : VMware.VMEncryption
|
# Script Module : VMware.VMEncryption
|
||||||
# Version : 1.0
|
# Version : 1.1
|
||||||
|
|
||||||
# Copyright © 2016 VMware, Inc. All Rights Reserved.
|
# Copyright © 2016 VMware, Inc. All Rights Reserved.
|
||||||
|
|
||||||
@@ -56,8 +56,13 @@ New-VIProperty -Name EncryptionKeyId -ObjectType VirtualMachine -Value {
|
|||||||
|
|
||||||
New-VIProperty -Name Locked -ObjectType VirtualMachine -Value {
|
New-VIProperty -Name Locked -ObjectType VirtualMachine -Value {
|
||||||
Param ($VM)
|
Param ($VM)
|
||||||
($vm.extensiondata.Runtime.ConnectionState -eq "invalid") -and ($vm.extensiondata.Config.KeyId)
|
if ($vm.ExtensionData.Runtime.CryptoState) {
|
||||||
} -BasedOnExtensionProperty 'Runtime.ConnectionState','Config.KeyId' -Force | Out-Null
|
$vm.ExtensionData.Runtime.CryptoState -eq "locked"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
($vm.extensiondata.Runtime.ConnectionState -eq "invalid") -and ($vm.extensiondata.Config.KeyId)
|
||||||
|
}
|
||||||
|
} -BasedOnExtensionProperty 'Runtime.CryptoState', 'Runtime.ConnectionState','Config.KeyId' -Force | Out-Null
|
||||||
|
|
||||||
New-VIProperty -Name vMotionEncryption -ObjectType VirtualMachine -Value {
|
New-VIProperty -Name vMotionEncryption -ObjectType VirtualMachine -Value {
|
||||||
Param ($VM)
|
Param ($VM)
|
||||||
@@ -113,13 +118,6 @@ Function Enable-VMHostCryptoSafe {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Baoyin Qiao.
|
Author : Baoyin Qiao.
|
||||||
Author email : bqiao@vmware.com
|
Author email : bqiao@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -181,13 +179,6 @@ Function Set-VMHostCryptoKey {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Baoyin Qiao.
|
Author : Baoyin Qiao.
|
||||||
Author email : bqiao@vmware.com
|
Author email : bqiao@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -266,13 +257,6 @@ Function Set-vMotionEncryptionConfig {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Brian Graf, Carrie Yang.
|
Author : Brian Graf, Carrie Yang.
|
||||||
Author email : grafb@vmware.com, yangm@vmware.com
|
Author email : grafb@vmware.com, yangm@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -348,13 +332,6 @@ Function Enable-VMEncryption {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Baoyin Qiao.
|
Author : Baoyin Qiao.
|
||||||
Author email : bqiao@vmware.com
|
Author email : bqiao@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -508,13 +485,6 @@ Function Enable-VMDiskEncryption {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Baoyin Qiao.
|
Author : Baoyin Qiao.
|
||||||
Author email : bqiao@vmware.com
|
Author email : bqiao@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -660,13 +630,6 @@ Function Disable-VMEncryption {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Carrie Yang.
|
Author : Carrie Yang.
|
||||||
Author email : yangm@vmware.com
|
Author email : yangm@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -756,13 +719,6 @@ Function Disable-VMDiskEncryption {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Carrie Yang.
|
Author : Carrie Yang.
|
||||||
Author email : yangm@vmware.com
|
Author email : yangm@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -891,13 +847,6 @@ Function Set-VMEncryptionKey {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Carrie Yang.
|
Author : Carrie Yang.
|
||||||
Author email : yangm@vmware.com
|
Author email : yangm@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -1047,13 +996,6 @@ Function Set-VMDiskEncryptionKey {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Carrie Yang.
|
Author : Carrie Yang.
|
||||||
Author email : yangm@vmware.com
|
Author email : yangm@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -1170,13 +1112,6 @@ Function Get-VMEncryptionInfo {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Carrie Yang.
|
Author : Carrie Yang.
|
||||||
Author email : yangm@vmware.com
|
Author email : yangm@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -1269,13 +1204,6 @@ Function Get-EntityByCryptoKey {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Baoyin Qiao.
|
Author : Baoyin Qiao.
|
||||||
Author email : bqiao@vmware.com
|
Author email : bqiao@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -1394,13 +1322,6 @@ Function New-KMServer {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Baoyin Qiao.
|
Author : Baoyin Qiao.
|
||||||
Author email : bqiao@vmware.com
|
Author email : bqiao@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -1435,6 +1356,7 @@ Function New-KMServer {
|
|||||||
)
|
)
|
||||||
|
|
||||||
Begin {
|
Begin {
|
||||||
|
write-warning "This cmdlet is deprecated and will be removed in future release. Use VMware.VimAutomation.Storage\Add-KeyManagementServer instead"
|
||||||
# Confirm the connected VIServer is vCenter Server
|
# Confirm the connected VIServer is vCenter Server
|
||||||
ConfirmIsVCenter
|
ConfirmIsVCenter
|
||||||
|
|
||||||
@@ -1553,13 +1475,6 @@ Function Remove-KMServer {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Baoyin Qiao.
|
Author : Baoyin Qiao.
|
||||||
Author email : bqiao@vmware.com
|
Author email : bqiao@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -1573,6 +1488,7 @@ Function Remove-KMServer {
|
|||||||
)
|
)
|
||||||
|
|
||||||
Begin {
|
Begin {
|
||||||
|
write-warning "This cmdlet is deprecated and will be removed in future release. Use VMware.VimAutomation.Storage\Remove-KeyManagementServer instead"
|
||||||
# Confirm the connected VIServer is vCenter Server
|
# Confirm the connected VIServer is vCenter Server
|
||||||
ConfirmIsVCenter
|
ConfirmIsVCenter
|
||||||
|
|
||||||
@@ -1630,15 +1546,9 @@ Function Get-KMSCluster {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Baoyin Qiao.
|
Author : Baoyin Qiao.
|
||||||
Author email : bqiao@vmware.com
|
Author email : bqiao@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
|
write-warning "This cmdlet is deprecated and will be removed in future release. Use VMware.VimAutomation.Storage\Get-KmsCluster instead"
|
||||||
# Confirm the connected VIServer is vCenter Server
|
# Confirm the connected VIServer is vCenter Server
|
||||||
ConfirmIsVCenter
|
ConfirmIsVCenter
|
||||||
|
|
||||||
@@ -1668,14 +1578,6 @@ Function Get-KMSClusterInfo {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Baoyin Qiao.
|
Author : Baoyin Qiao.
|
||||||
Author email : bqiao@vmware.com
|
Author email : bqiao@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -1686,6 +1588,7 @@ Function Get-KMSClusterInfo {
|
|||||||
)
|
)
|
||||||
|
|
||||||
Begin {
|
Begin {
|
||||||
|
write-warning "This cmdlet is deprecated and will be removed in future release. Use VMware.VimAutomation.Storage\Get-KmsCluster instead"
|
||||||
# Confirm the connected VIServer is vCenter Server
|
# Confirm the connected VIServer is vCenter Server
|
||||||
ConfirmIsVCenter
|
ConfirmIsVCenter
|
||||||
|
|
||||||
@@ -1721,13 +1624,6 @@ Function Get-KMServerInfo {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Baoyin Qiao.
|
Author : Baoyin Qiao.
|
||||||
Author email : bqiao@vmware.com
|
Author email : bqiao@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -1738,6 +1634,7 @@ Function Get-KMServerInfo {
|
|||||||
)
|
)
|
||||||
|
|
||||||
Begin {
|
Begin {
|
||||||
|
write-warning "This cmdlet is deprecated and will be removed in future release. Use VMware.VimAutomation.Storage\Get-KeyManagementServer instead"
|
||||||
# Confirm the connected VIServer is vCenter Server
|
# Confirm the connected VIServer is vCenter Server
|
||||||
ConfirmIsVCenter
|
ConfirmIsVCenter
|
||||||
|
|
||||||
@@ -1782,13 +1679,6 @@ Function Get-KMServerStatus {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Baoyin Qiao.
|
Author : Baoyin Qiao.
|
||||||
Author email : bqiao@vmware.com
|
Author email : bqiao@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -1853,15 +1743,9 @@ Function Get-DefaultKMSCluster {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Baoyin Qiao.
|
Author : Baoyin Qiao.
|
||||||
Author email : bqiao@vmware.com
|
Author email : bqiao@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
|
write-warning "This cmdlet is deprecated and will be removed in future release. Use VMware.VimAutomation.Storage\Get-KmsCluster instead"
|
||||||
# Confirm the connected VIServer is vCenter Server
|
# Confirm the connected VIServer is vCenter Server
|
||||||
ConfirmIsVCenter
|
ConfirmIsVCenter
|
||||||
|
|
||||||
@@ -1890,13 +1774,6 @@ Function Set-DefaultKMSCluster {
|
|||||||
.NOTES
|
.NOTES
|
||||||
Author : Baoyin Qiao.
|
Author : Baoyin Qiao.
|
||||||
Author email : bqiao@vmware.com
|
Author email : bqiao@vmware.com
|
||||||
Version : 1.0
|
|
||||||
|
|
||||||
==========Tested Against Environment==========
|
|
||||||
VMware vSphere Hypervisor(ESXi) Version : 6.5
|
|
||||||
VMware vCenter Server Version : 6.5
|
|
||||||
PowerCLI Version : PowerCLI 6.5
|
|
||||||
PowerShell Version : 3.0
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdLetBinding()]
|
[CmdLetBinding()]
|
||||||
@@ -1906,6 +1783,7 @@ Function Set-DefaultKMSCluster {
|
|||||||
[String] $KMSClusterId
|
[String] $KMSClusterId
|
||||||
)
|
)
|
||||||
|
|
||||||
|
write-warning "This cmdlet is deprecated and will be removed in future release. Use VMware.VimAutomation.Storage\Set-KmsCluster instead"
|
||||||
# Confirm the connected VIServer is vCenter Server
|
# Confirm the connected VIServer is vCenter Server
|
||||||
ConfirmIsVCenter
|
ConfirmIsVCenter
|
||||||
|
|
||||||
@@ -1917,6 +1795,55 @@ Function Set-DefaultKMSCluster {
|
|||||||
$CM.MarkDefault($ProviderId)
|
$CM.MarkDefault($ProviderId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Function Set-VMCryptoUnlock {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
This cmdlet unlocks a locked vm
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
This cmdlet unlocks a locked vm
|
||||||
|
|
||||||
|
.PARAMETER VM
|
||||||
|
Specifies the VM you want to unlock
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
PS C:\> Get-VM |where {$_.locked}| Set-VMCryptoUnlock
|
||||||
|
|
||||||
|
Unlock all locked vms
|
||||||
|
|
||||||
|
.NOTES
|
||||||
|
Author : Fangying Zhang
|
||||||
|
Author email : fzhang@vmware.com
|
||||||
|
#>
|
||||||
|
|
||||||
|
[CmdLetBinding()]
|
||||||
|
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True)]
|
||||||
|
[VMware.VimAutomation.ViCore.Types.V1.Inventory.VirtualMachine[]]$VM
|
||||||
|
)
|
||||||
|
|
||||||
|
Begin {
|
||||||
|
# Confirm the connected VIServer is vCenter Server
|
||||||
|
ConfirmIsVCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
foreach ($thisvm in $vm) {
|
||||||
|
if (!$thisvm.encrypted) {
|
||||||
|
write-warning "$thisvm is not encrypted, will skip $thisvm"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (!$thisvm.Locked) {
|
||||||
|
write-warning "$thisvm may not be locked!"
|
||||||
|
# $thisvm.locked could be false on old 6.5.0 build (bug 1931370), so do not skip $thisvm
|
||||||
|
}
|
||||||
|
write-verbose "try to CryptoUnlock $thisvm"
|
||||||
|
$thisvm.ExtensionData.CryptoUnlock()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Function ConfirmIsVCenter{
|
Function ConfirmIsVCenter{
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
|||||||
Reference in New Issue
Block a user