Created
April 18, 2018 15:00
-
-
Save R41D3NN/401bc1bcb95701d8a875147f231685cb to your computer and use it in GitHub Desktop.
Creates a Hyper-V NAT'd internal switch.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$switchName = "my.local" | |
New-VMSwitch -SwitchName $switchName -SwitchType Internal | |
$netAdapter = Get-NetAdapter | Where -Property Name -Eq "vEthernet ($switchName)" | |
New-NetIPAddress -IPAddress 10.0.0.1 -PrefixLength 24 -InterfaceIndex $netAdapter.ifIndex | |
New-NetNat -Name "$switchName-NAT" -InternalIPInterfaceAddressPrefix 10.0.0.0/24 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment