2,187
edits
(→Storage: Added upload to datastore) |
(→Script Extracts: Added "Ping All VM's On ESX") |
||
Line 434: | Line 434: | ||
} | } | ||
} | } | ||
} | |||
</source> | |||
=== Ping All VM's On ESX === | |||
Useful sanity check prior to and after network level changes | |||
<source lang="Powershell"> | |||
$ESX = get-vmhost "ESXToTest" | |||
# Get list of VM's on $ESX | |||
$VMs = $ESX | get-vm | Where {$_.PowerState -eq "PoweredOn"} | Sort -property Name | |||
$objPing = New-Object system.Net.NetworkInformation.Ping | |||
Foreach ($VM in $VMs) { | |||
Write-Host $VM.Name.PadRight(20) -nonewline | |||
# Get guest's primary IP address | |||
$ip = (Get-VMGuest -VM $vm).IPAddress[0] | |||
if (!$ip) { | |||
Write-Host "NULL - Skip" -Background DarkYellow -ForegroundColor Yellow | |||
Continue | |||
} | |||
Write-Host $ip.PadRight(17) -nonewline | |||
[string]$res = $objPing.Send($ip).Status | |||
if ($res.CompareTo("Success")) { # Returns 1 if $res doesn't match "Success" !! | |||
Write-Host $res -BackgroundColor DarkRed -ForegroundColor Red | |||
} else { | |||
Write-Host $res -BackgroundColor DarkGreen -ForegroundColor Green | |||
} | |||
} | } | ||
</source> | </source> |