-
Notifications
You must be signed in to change notification settings - Fork 0
/
PodeWebServer.ps1
31 lines (26 loc) · 1.56 KB
/
PodeWebServer.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
Param(
$gitpat
)
Start-Transcript C:\log.txt
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module Pode -force
Install-Module Evergreen -force
$PSUrl = Get-EvergreenApp MicrosoftPowershell | Where-Object { $_.Architecture -eq "x64" -and $_.Type -eq "msi" -and $_.Release -eq "Stable" }
$PSUrl.URI
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri $PSUrl.URI -OutFile "$env:TEMP\$(Split-Path $PSUrl.URI -Leaf)"
Start-Process msiexec -ArgumentList "/i $env:TEMP\$(Split-Path $PSUrl.URI -Leaf) /qn /norestart /l*v `"$($env:TEMP)\PS.MsiInstall.log`" ALLUSERS=1 DISABLEDESKTOPSHORTCUT=1 ADDDESKTOPICON=0 ADDSTARTMENU=0" -Wait
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install git -y
New-Item -Type Directory C:\Scripts
Set-Location C:\Scripts
Start-Process "C:\Program Files\Git\bin\git.exe" -argumentlist "clone https://anything:[email protected]/breento-devops/Evergreen/_git/Evergreen" -wait
choco install nssm -y
New-NetFirewallRule -DisplayName "Pode Allow Inbound Port 8080" -Direction Inbound -LocalPort 8080 -Protocol TCP -Action Allow
$exe = (Get-Command pwsh.exe).Source
$name = 'PodeWebServer'
$file = 'C:\Scripts\Evergreen\Server.ps1'
$arg = "-ExecutionPolicy Bypass -NoProfile -Command `"$($file)`""
nssm install $name $exe $arg
Start-Service $name
Stop-Transcript