Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benyoungnz/0bc6c69b6326129f2e9bcca6bbfcd678 to your computer and use it in GitHub Desktop.
Save benyoungnz/0bc6c69b6326129f2e9bcca6bbfcd678 to your computer and use it in GitHub Desktop.
#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