Server IP : 180.180.241.3 / Your IP : 216.73.216.252 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Program Files/CA/arcserve Unified Data Protection/Engine/BIN/Appliance/ |
Upload File : |
stop-transcript 2>&1 start-transcript -path $($MyInvocation.MyCommand.Name+".log") -force write-host "Setting up NAT ..." $truenics = gwmi Win32_NetworkAdapterConfiguration| Where-Object {$_.IPEnabled -eq 'True'} $truenics $macpri = @($($truenics | where-object{$_.ipaddress -match "192.168.10.1"}).macaddress) $macpri if($macpri -eq $null){throw "cannot find the mac with ip 192.168.10.1"} $namepri= $(gwmi Win32_NetworkAdapter| Where-Object {$_.macaddress -match $macpri}).NetConnectionID $namepri $namepub= $(gwmi Win32_NetworkAdapter| Where-Object {$_.macaddress -in $truenics.macaddress}| Where-Object {$_.macaddress -notmatch $macpri}).NetConnectionID $namepub if($namepub.count -eq 0){"namepub count is 0, returning.";return;} $c= netsh routing ip nat dump $c $regexpri = "add interface.*$namepri.*private" $regexpri $tmp=$namepub[0] $regexpub = "add interface.*$tmp.*full" $regexpub $c|foreach-object{if($_ -match $regexpri){$priexist = $true;};if($_ -match $regexpub){$pubexist = $true;}} $priexist $pubexist if($priexist -and $pubexist){return;} if ($namepub.count -eq 1){ .\nat.bat $namepri $namepub >nat.log 2>&1 } if ($namepub.count -ge 2){ set-content .\nat2.bat (get-content .\nat.bat).replace('rem rem3rdpara','if not %3=="" netsh routing ip nat add interface name=%3 mode=FULL && netsh interface ipv4 set interface %3 forwarding=enabled') .\nat2.bat $namepri $namepub[0] $namepub[1] >nat.log 2>&1 }