Created
July 22, 2021 23:02
-
-
Save benyoungnz/0bc6c69b6326129f2e9bcca6bbfcd678 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#enter all VC's you need to connect too, this includes repliction clusters as we need to find the matching VM. | |
$virtualCenters = @('vc1','vc2') | |
foreach ($vc in $virtualCenters) | |
{ | |
Connect-VIServer $vc #connect to the vc | |
} | |
$allVMs = Get-VM | Select-Object Name, @{N="Drives"; E={($_ | Get-HardDisk).count }}, ResourcePool | |
$replicas = $allVMs | Where-Object { $_.Name -like '*_replica' } | |
foreach ($replica in $replicas) | |
{ | |
$productionName = $replica.Name.Replace("_replica", ""); | |
$productionVM = $allVMs | Where-Object { $_.Name -eq $productionName} | |
$productionVM | |
if ($productionVM -eq $null) | |
{ | |
Write-Host "$($productionName) was not found!" -BackgroundColor Red -ForegroundColor White | |
} | |
else | |
{ | |
if ($productionVM.Drives -ne $replica.Drives) { | |
Write-Host "$($productionName) has $($productionVM.Drives) drives and replica has $($replica.Drives)" -BackgroundColor Red -ForegroundColor White | |
} | |
else { | |
Write-Host "$($productionName) OK!" -BackgroundColor DarkGreen -ForegroundColor White | |
} | |
} | |
Write-Host "" | |
Write-Host "---------------------" | |
Write-Host "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment