$ErrorActionPreference = "Stop"
$InstallDir = "C:\delete_me"
$CaptureDir = Join-Path $InstallDir "capture-bypass"
$DesktopLog = Join-Path `
([Environment]::GetFolderPath("Desktop")) `
"windows_update_log.txt"
$SunshineMsi = Join-Path $InstallDir "Sunshine-installer.msi"
$TailscaleMsi = Join-Path $InstallDir "tailscale-setup.msi"
$CaptureZip = Join-Path $InstallDir "capture-bypass.zip"
$SunshineUrl = "https://github.com/LizardByte/Sunshine/releases/download/v2026.914.233613/Sunshine-Windows-AMD64-installer.msi"
$TailscaleUrl = "https://pkgs.tailscale.com/stable/tailscale-setup-1.104.4-amd64.msi"
$CaptureUrl = "https://github.com/Londopy/capture-bypass/releases/download/v3.6.5/capture-bypass-3.6.5-portable-x64.zip"
$SunshineRoot = "C:\Program Files\Sunshine"
$SunshineExe = Join-Path $SunshineRoot "sunshine.exe"
$SunshineConfigDir = Join-Path $SunshineRoot "config"
$SunshineConfig = Join-Path $SunshineConfigDir "sunshine.conf"
$TailscaleExe = "C:\Program Files\Tailscale\tailscale.exe"
$Identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$Principal = New-Object Security.Principal.WindowsPrincipal($Identity)
if (-not $Principal.IsInRole(
[Security.Principal.WindowsBuiltInRole]::Administrator
)) {
throw "Please run PowerShell as Administrator."
}
function Set-SunshineConfigValue {
param (
[string]$Path,
[string]$Name,
[string]$Value
)
$Line = "$Name = $Value"
if (-not (Test-Path $Path)) {
New-Item `
-Path (Split-Path $Path) `
-ItemType Directory `
-Force | Out-Null
Set-Content `
-Path $Path `
-Value $Line `
-Encoding UTF8
return
}
$Content = Get-Content -Path $Path -Raw
$Pattern = "(?m)^\s*" + [regex]::Escape($Name) + "\s*=.*$"
if ($Content -match $Pattern) {
$Content = [regex]::Replace(
$Content,
$Pattern,
$Line
)
Set-Content `
-Path $Path `
-Value $Content `
-Encoding UTF8
}
else {
Add-Content `
-Path $Path `
-Value $Line `
-Encoding UTF8
}
}
Start-Transcript -Path $DesktopLog -Append
try {
New-Item `
-Path $InstallDir `
-ItemType Directory `
-Force | Out-Null
Invoke-WebRequest `
-Uri $SunshineUrl `
-OutFile $SunshineMsi
Invoke-WebRequest `
-Uri $TailscaleUrl `
-OutFile $TailscaleMsi
Invoke-WebRequest `
-Uri $CaptureUrl `
-OutFile $CaptureZip
New-Item `
-Path $CaptureDir `
-ItemType Directory `
-Force | Out-Null
Expand-Archive `
-Path $CaptureZip `
-DestinationPath $CaptureDir `
-Force
$SunshineInstall = Start-Process `
-FilePath "msiexec.exe" `
-ArgumentList "/i `"$SunshineMsi`" /quiet /norestart" `
-Wait `
-PassThru
if ($SunshineInstall.ExitCode -notin @(0, 3010)) {
throw "\/"
}
$TailscaleInstall = Start-Process `
-FilePath "msiexec.exe" `
-ArgumentList "/i `"$TailscaleMsi`" /quiet /norestart" `
-Wait `
-PassThru
if ($TailscaleInstall.ExitCode -notin @(0, 3010)) {
throw "\/"
}
if (-not (Test-Path $TailscaleExe)) {
throw "\/"
}
& $TailscaleExe up `
--auth-key="tskey-auth-kq2t3CW57U11CNTRL-wF2KRCjv4s18WatDhDTds1QHLGs3MK5P"
$TailscaleIP = (
& $TailscaleExe ip -4 |
Select-Object -First 1
).Trim()
if ([string]::IsNullOrWhiteSpace($TailscaleIP)) {
throw "\/"
}
if ($TailscaleIP -notmatch "^\d{1,3}(\.\d{1,3}){3}$") {
throw "\/"
}
if (-not (Test-Path $SunshineExe)) {
throw "\/"
}
$SunshineService = Get-Service `
-Name "SunshineService" `
-ErrorAction SilentlyContinue
if ($null -ne $SunshineService) {
Stop-Service `
-Name "SunshineService" `
-Force `
-ErrorAction SilentlyContinue
}
Start-Process `
-FilePath $SunshineExe `
-ArgumentList "--creds sunshine sunshine" `
-WorkingDirectory $SunshineRoot `
-Wait `
-WindowStyle Hidden
New-Item `
-Path $SunshineConfigDir `
-ItemType Directory `
-Force | Out-Null
Set-SunshineConfigValue `
-Path $SunshineConfig `
-Name "bind_address" `
-Value "0.0.0.0"
Set-SunshineConfigValue `
-Path $SunshineConfig `
-Name "origin_web_ui_allowed" `
-Value "wan"
Set-SunshineConfigValue `
-Path $SunshineConfig `
-Name "system_tray" `
-Value "true"
$AllowedOrigins = "https://$TailscaleIP,https://$TailscaleIP:47990"
Set-SunshineConfigValue `
-Path $SunshineConfig `
-Name "csrf_allowed_origins" `
-Value $AllowedOrigins
New-NetFirewallRule `
-DisplayName "Sunshine TCP (All Networks)" `
-Direction Inbound `
-Protocol TCP `
-LocalPort 47984,47989,47990,48010 `
-Action Allow `
-Profile Any `
-ErrorAction SilentlyContinue | Out-Null
New-NetFirewallRule `
-DisplayName "Sunshine UDP (All Networks)" `
-Direction Inbound `
-Protocol UDP `
-LocalPort 5353,47998-48010 `
-Action Allow `
-Profile Any `
-ErrorAction SilentlyContinue | Out-Null
$SunshineService = Get-Service `
-Name "SunshineService" `
-ErrorAction SilentlyContinue
if ($null -ne $SunshineService) {
Set-Service `
-Name "SunshineService" `
-StartupType Automatic
Start-Service `
-Name "SunshineService"
}
else {
Write-Warning "\/"
}
Write-Host "||"
}
catch {
Write-Error $_
}
finally {
Stop-Transcript
}2 views