Skip to content

Instantly share code, notes, and snippets.

@WindyNova
Created July 19, 2024 12:57
Show Gist options
  • Select an option

  • Save WindyNova/ac6fd30c1fb597c3447f12db2ac843cd to your computer and use it in GitHub Desktop.

Select an option

Save WindyNova/ac6fd30c1fb597c3447f12db2ac843cd to your computer and use it in GitHub Desktop.
Enable Routing
# Self-elevate the script if required
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
$CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
Exit
}
}
Set-NetIPInterface -Forwarding Disabled
netsh int ipv4 set interface "Z1" forwarding=enabled
netsh int ipv4 set interface "Z2" forwarding=enabled
netsh int ipv4 set interface "VMware Network Adapter VMnet1" forwarding=enabled
# netsh int ipv4 set interface "��̫��" forwarding=enabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment