Sha256: 6f8ee6f014085143efe06a59fd6d9e12aff3b744998065d97fb4743fd6314f5f
Contents?: true
Size: 756 Bytes
Versions: 29
Compression:
Stored size: 756 Bytes
Contents
#Requires -Modules VagrantMessages param( [Parameter(Mandatory=$true)] [string]$VmId ) $ErrorActionPreference = "Stop" try { $ip_address = "" $vm = Hyper-V\Get-VM -Id $VmId $networks = Hyper-V\Get-VMNetworkAdapter -VM $vm foreach ($network in $networks) { if ($network.MacAddress -gt 0) { $mac_address = $network.MacAddress if (-Not ([string]::IsNullOrEmpty($mac_address))) { # We found our mac address! break } } } $resultHash = @{ mac = "$mac_address" } $result = ConvertTo-Json $resultHash Write-OutputMessage $result } catch { Write-ErrorMessage "Unexpected error while fetching MAC: ${PSItem}" exit 1 }
Version data entries
29 entries across 25 versions & 4 rubygems