vCenter

 View Only
  • 1.  migrate resource pool fromone vcenter to another

    Posted Dec 21, 2022 08:06 PM
      |   view attached

    HI I have vcenter 6.7 and vCenter 7 running. I am supposed to move copy resource pools from one vcenter to another and so far I have used this

    #Begin RessourcePool export
    Write-Host "Exporting " -NoNewline
    Write-Host "Ressource Pool" -ForegroundColor Green
    Write-Host
    Start-Sleep -Seconds 1

    #Export Ressource Pool for folders from the source Cluster.

    #
    $clusterName = "Lab1 Cluster"

    $cluster = Get-Cluster -Name $clusterName
    Get-ResourcePool -Location $cluster | Export-Csv C:\vspherescripts\scriptsoutput\resourcepoolshares.csv -NoTypeInformation -UseCulture
    #End Ressource Pool export

     

    All good and it gave me output like in attached picture

     

    Now Second portion was to import

    #Begin ResourcePool Import
    Write-Host "Importing " -NoNewline
    Write-Host "Ressource Pool" -ForegroundColor Green
    Write-Host
    Start-Sleep -Seconds 1
    #Imrt Ressource Pool for folders from the source Cluster.

    foreach($row in (Import-Csv C:\vspherescripts\scriptsoutput\resourcepoolshares.csv -UseCulture)){
    $pools = $row.Name
    Try {
    $skip = $false
    $location = Get-Cluster -Name $cluster -ErrorAction Stop
    }
    Catch {
    "Cluster $clusterName not found"
    $skip = $true
    }
    if(!$skip){
    foreach($rp in $pools){
    Try {
    $location = Get-ResourcePool -Name $row.name -Location $location -ErrorAction Stop
    }
    Catch {
    $location =New-ResourcePool -Location $Location -Name $rp -NumCpuShares $row.NumCpuShares -CpuReservationMHz $row.CpuReservationMHz -CpuExpandableReservation ([System.Convert]::ToBoolean($row.CpuExpandableReservation)) -CpuLimitMHz $row.CpuLimitMHz -MemSharesLevel $row.MemSharesLevel -NumMemShares $row.NumMemShares -MemReservationMB $row.MemReservationMB -MemExpandableReservation ([System.Convert]::ToBoolean($row.MemExpandableReservation)) -MemLimitMB $row.MemLimitMB

    }
    }
    }
    }

     

    #End Ressource Pool export

     

    Script was run ok no issues reported however resource pools in new vcenter they come with standard values nothing changed like it was in old 6.7 vcenter

     



  • 2.  RE: migrate resource pool fromone vcenter to another

    Posted Dec 21, 2022 11:07 PM

    This is a statement or somewhere was a question. 
    But for a such script big thank you.