Sha256: 1fef6066dd7f2a79c225337287dadb0a7352b9830b31c61774668376f8061cb8

Contents?: true

Size: 524 Bytes

Versions: 1

Compression:

Stored size: 524 Bytes

Contents

param (
    [parameter (Mandatory=$true)]
    [string]$VmId,
    [parameter (Mandatory=$true)]
    [string]$Id,
    [parameter (Mandatory=$true)]
    [string]$SwitchId

)

try {
    $vm = Get-VM -Id $VmId
    $switch = Get-VMSwitch -Id $SwitchId
    Get-VMNetworkAdapter -VM $vm | Where-Object -Property Id -EQ -Value $Id | Connect-VMNetworkAdapter -VMSwitch $switch
}
catch {
    Write-ErrorMessage "Failed to connect adapter ${Id} of VM ${VmId} to switch ${SwitchId}: ${PSItem}"
    exit 1            
 }

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-hypervnet-0.1.4 lib/vagrant-hypervnet/scripts/connect_vm_adapter.ps1