Update method to add VMs to Object
This commit is contained in:
@@ -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']
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user