Last active
August 29, 2015 14:27
-
-
Save sajayantony/b6b41edacc5b947314a4 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
param( | |
[Parameter(Mandatory=$true)] | |
[string]$vmname | |
) | |
$ipAddresses = Get-VM -name $vmname | Select -ExpandProperty networkadapters | select IPAddresses | |
while ($ipAddresses.IPAddresses.Count -eq 0) | |
{ | |
Write-Host "Waiting for VM to be ready" | |
Start-Sleep -Milliseconds 500 | |
$ipAddresses = Get-VM -name $vmname | Select -ExpandProperty networkadapters | select IPAddresses | |
} | |
$vmIP = $ipAddresses.IPAddresses[0] | |
Write-Host "Ready with IP $vmIP" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment