Hirdetés
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- Cseresznyepiros és mokka barna Redmi Note 15-ök az újévre
- Samsung Galaxy S23 és S23+ - ami belül van, az számít igazán
- Visszatérnek a Samsung tervezte CPU-magok és GPU az Exynos 2800-ban?
- Eddigi legjobb DxOMark helyezésével zárta 2025-öt a Vivo
- Amazfit Active 2 NFC - jó kör
- Samsung Galaxy S24 Ultra - ha működik, ne változtass!
- Netfone
- iPhone topik
- Ezzel a mobillal készülhet a 2026-os MWC-re a HMD
-
Mobilarena
Sziasztok, udvozlunk mindenkit Magyarorszag legnagyobb VMware forumjaban!

Új hozzászólás Aktív témák
-
válasz
szallasi007
#4730
üzenetére
Indulásnak memóriához
$Cluster="clusterneve"
Write-Host ""
Write-Host "Checking the following cluster to balance: $Cluster"-foregroundcolor "DarkGreen"
Write-Host ""
$hostinfo = Get-Cluster $Cluster |Get-VMHost | Get-View
# Pull memory stats from each host
$hostram = @{}
$clusterram = 0
$hostinfo | % {
$hostram.Add($_.Name,$_.Summary.QuickStats.OverallMemoryUsage)
$clusterram += $_.Summary.QuickStats.OverallMemoryUsage}
$hostram.GetEnumerator() | Sort-Object Name
# Determine the delta of memory on the least loaded host
$deltahost = ($hostram.GetEnumerator() | Sort-Object Value)[0].Name
$deltaram = [Math]::Round((($clusterram / $hostinfo.Count) - ($hostram.GetEnumerator() | Sort-Object Value)[0].Value),0)
# Check if there is a host without VMs
$esx_list=Get-Cluster $Cluster|Get-VMHost
$esxWithoutVMS=0
foreach ($esx in $esx_list)
{
$vms=(get-vmhost $esx| get-vm|Where {$_.PowerState -eq "PoweredOn"}).count
Write-Host "# of VMs on $($esx): $vms" -foregroundcolor "DarkGreen"
if ($vms -eq 0)
{
$esxWithoutVMS++
}
}
if ($deltaram -lt 16384 -and $esxWithoutVMS -eq 0)
{
Write-Host ""
Write-Host "No empty hosts and/or less than 16G difference in host memory usage," -foregroundcolor "DarkGreen"
Write-Host "no need to balance, we are done. Exiting script ..." -foregroundcolor "DarkGreen"
Write-Host ""
exit 1
}
$deltamoref = (Get-VMHost -Name $deltahost).Id
Write-Host ""
Write-Host "Let me try to remediate the imbalance on:" -foregroundcolor "DarkGreen"
Write-Host "$deltahost" -foregroundcolor "DarkGreen"
Write-Host ""
# Find VMs that can fill the delta from other hosts
$vmram = @{}
Get-VM -Location (Get-Cluster $cluster) | Get-View | % {if ($_.Runtime.PowerState -match "poweredOn") {$vmram.Add($_.Name,$_.Summary.QuickStats.HostMemoryUsage)}}
# Run through VMs and migrate the smallest ones
$i = 0
$nomigration = $true
while ($nomigration){
$targetvm = ($vmram.GetEnumerator() | Sort-Object Value)[$i].Name
if (((Get-VM -Name $targetvm | Get-View).Runtime.Host) -ne $deltamoref) {
Write-Host ""
Write-Host "Moving $targetvm to $deltahost" -foregroundcolor "DarkGreen"
Write-Host ""
Move-VM -VM (Get-VM -Name $targetvm) -Destination (Get-VMHost -Name $deltahost) -VMotionPriority:High | Out-Null
$nomigration = $false
}
$i++
#catch all
if ($i -ge 100) {$nomigration = $false}
Write-Host ""
Write-Host "Finished balancing $Cluster" -foregroundcolor "DarkGreen"
Write-Host ""
}
Új hozzászólás Aktív témák
- Le Mans Ultimate
- One otthoni szolgáltatások (TV, internet, telefon)
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- Cseresznyepiros és mokka barna Redmi Note 15-ök az újévre
- Battlefield 6
- Eredeti játékok OFF topik
- Samsung Galaxy S23 és S23+ - ami belül van, az számít igazán
- Lakáshitel, lakásvásárlás
- Amlogic S905, S912 processzoros készülékek
- Azonnali VGA-s kérdések órája
- További aktív témák...
- ÁRGARANCIA!Épített KomPhone Ryzen 7 9800X3D 32/64GB RAM RX 9070 XT 16GB GAMER PC termékbeszámítással
- GYÖNYÖRŰ iPhone 14 Pro 128GB Space Black -1 ÉV GARANCIA - Kártyafüggetlen, MS4041, 100% Akksi
- GYÖNYÖRŰ iPhone 12 mini 128GB Blue -1 ÉV GARANCIA - Kártyafüggetlen, MS3853
- BESZÁMÍTÁS! Apple Macbook Air 15 2025 M4 16GB 256GB SSD macbook garanciával hibátlan működéssel
- Akció!!! Microsoft Surface Laptop 4 13.5" i7-1185G7 16GB 512GB 1 év garancia
Állásajánlatok
Cég: Laptopszaki Kft.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest



