$Natswitchname = “OKD4-NATSwitch”
$NATNetwork = “192.168.200.0”
$NATrouteraddress = “192.168.200.1”
$NATPrefixLength = “24”
New-VMSwitch –SwitchName $Natswitchname –SwitchType Internal –Verbose
$natswitch = Get-NetAdapter | where {(($_.name -like (“vEthernet ($Natswitchname)”)))}
New-NetIPAddress $NATrouteraddress -PrefixLength $NATPrefixLength -InterfaceIndex $natswitch.interfaceindex -Verbose
$NATNetworkFull = $NATNetwork + “/” + $NATPrefixLength
New-NetNat -Name HyperV-NatNetwork -InternalIPInterfaceAddressPrefix $NATNetworkFull -Verbose
Windows System Error 52,New-NetNat
ขอขอบคุณวิธีแก้จาก url ด้านล่างครับ
https://social.msdn.microsoft.com/Forums/vstudio/en-US/7d36c178-3519-4715-a42a-c30ef0f1b9f5/not-able-to-create-virtual-switch-on-window-server-2016-full-preview-4?forum=windowscontainers
UPDATE: My issue was solved by removing the existing NetNat object. Get-NetNat showed me an object already existed with the same subnet and I was able to manually fix the issue (if you're using a script, try removing (Remove-NetNat) the object and run the script again)