File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,6 @@ if((Test-Path variable:islinux) -and $isLinux) {
1515 return
1616}
1717
18- # get current IP
19- $ip = (Get-NetIPAddress - AddressFamily IPv4 | Where-Object {$_.InterfaceAlias -like ' ethernet*' }).IPAddress
20- $port = 3389
21-
2218# get password or generate
2319$password = ' '
2420if ($env: appveyor_rdp_password ) {
@@ -32,7 +28,14 @@ if($env:appveyor_rdp_password) {
3228 $password = [Microsoft.Win32.Registry ]::GetValue(" HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" , " DefaultPassword" , ' ' )
3329}
3430
31+ $port = 3389
3532if (-not $nonat ) {
33+ if (! (Get-Command " Get-NetIPAddress" - errorAction SilentlyContinue)) {
34+ Write-Warning " NAT translation needs cmdlet 'Get-NetIPAddress', use ps and/or newer VS Image."
35+ return
36+ }
37+ # get current IP
38+ $ip = (Get-NetIPAddress - AddressFamily IPv4 | Where-Object {$_.InterfaceAlias -like ' ethernet*' }).IPAddress
3639 if ($ip.StartsWith (' 172.24.' )) {
3740 $port = 33800 + ($ip.split (' .' )[2 ] - 16 ) * 256 + $ip.split (' .' )[3 ]
3841 } elseif ($ip.StartsWith (' 192.168.' ) -or $ip.StartsWith (' 10.240.' )) {
You can’t perform that action at this time.
0 commit comments