Update method to add VMs to Object

This commit is contained in:
Wes Carroll
2019-07-29 08:50:25 -04:00
parent a4e3961bd7
commit 7b07fb0fd7
+1 -8
View File
@@ -214,7 +214,6 @@ function New-ZertoVpg {
$unprotectedVms = Get-ZertoUnprotectedVm
$protectedVms = Get-ZertoProtectedVm
# Create array of VM identifiers
$vmIdentifiers = @()
$vmIdentifiers = foreach ($vm in $protectedVm) {
# If the VM is unprotected, get the identifier
$vmIdentifier = $unprotectedVms | Where-Object { $_.vmName -like $vm } | Select-Object -ExpandProperty vmIdentifier
@@ -314,13 +313,7 @@ function New-ZertoVpg {
$baseSettings.Recovery.DefaultDatastoreIdentifier = $identifiersTable['datastoreIdentifier']
}
}
# If only 1 VM is selected, force VMs settings to be an array.
If ($vmIdentifiers.count -eq 1) {
$basesettings.Vms = @()
$baseSettings.Vms += $vmIdentifiers
} else {
$baseSettings.Vms = $vmIdentifiers
}
$basesettings.Vms += $vmIdentifiers
if ($identifiersTable.ContainsKey('journalDatastore')) {
$baseSettings.Journal.DatastoreIdentifier = $identifiersTable['journalDatastore']
}