
$my_temp = select-template -SearchText $tempName
if ($my_temp -eq $null)
{
Write-host "No matching templates found!"
exit
} elseif ($my_temp.count -gt 1) {
Write-host "Too many matching templates found!"
exit
} elseif ($my_temp.name -eq "Blank") {
Write-host "Can not use Blank template!"
exit
}
#search for matching basenames
#search for matching basenames
$matches = select-vm -searchtext "$baseName" | where {$_.name -like "$baseName*"}
if ($matches -ne $null) {
$measure = $matches | select-object name | foreach { $_.name.Replace("$baseName","") } |
measure-object -max
$start = $measure.maximum + 1
$x = $matches | select-object -first 1
$my_clusId = $x.HostClusterId
} else {
$start = 1
}
$id = $my_temp.HostClusterId
$clus = select-cluster | where { $_.ClusterID -eq $id }
if ($clus -ne $null) {
if ($clus.IsInitialized -eq $true) {
$my_clusId = $id
} else {
write-host "Cluster of Template is not initialized!"
exit
}
}
#loop over adds async
for ($i=$start; $i -lt $start + $num; $i++) {
# write-host "-name $baseName$i -templateobject $my_temp -HostClusterId $my_clusId
-copytemplate -Vmtype server"
if ( $run -eq $true ) {
$my_vm = add-vm -name $baseName$i -templateobject $my_temp -HostClusterId $my_clusId
-copytemplate -Vmtype server
#Until BZ 617730 and 617725 are addressed, use this work around
www.redhat.com 130
Comentários a estes Manuais