19 lines
374 B
PowerShell
19 lines
374 B
PowerShell
#Requires -Modules VagrantMessages
|
|
|
|
param (
|
|
[parameter (Mandatory=$true)]
|
|
[string]$VmId,
|
|
[parameter (Mandatory=$true)]
|
|
[string]$Mac
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
try {
|
|
$vm = Hyper-V\Get-VM -Id $VmId
|
|
Hyper-V\Set-VMNetworkAdapter $vm -StaticMacAddress $Mac
|
|
} catch {
|
|
Write-Error-Message "Failed to set VM MAC address: ${PSItem}"
|
|
exit 1
|
|
}
|