Keep track of selected Hyper-V switch using the ID instead of name to prevent any encoding issues that may occur switching between PowerShell and Ruby. With the IDs staying consistent, the switch name can be fetched from the provided ID. Fixes #9679 #8794 #9451
13 lines
430 B
PowerShell
13 lines
430 B
PowerShell
# This will have a SwitchType property. As far as I know the values are:
|
|
#
|
|
# 0 - Private
|
|
# 1 - Internal
|
|
#
|
|
# Include the following modules
|
|
$Dir = Split-Path $script:MyInvocation.MyCommand.Path
|
|
. ([System.IO.Path]::Combine($Dir, "utils\write_messages.ps1"))
|
|
|
|
$Switches = @(Hyper-V\Get-VMSwitch `
|
|
| Select-Object Name,SwitchType,NetAdapterInterfaceDescription,Id)
|
|
Write-Output-Message $(ConvertTo-JSON $Switches)
|