Fix: split into bat launcher + ps1, TLS 1.2, single-session PATH fix, Server 2016 compat
This commit is contained in:
79
setup-windows.ps1
Normal file
79
setup-windows.ps1
Normal file
@ -0,0 +1,79 @@
|
||||
# TLS 1.2 erzwingen (notwendig auf Windows Server 2016 / älteren Systemen)
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
# Adminrechte prüfen und ggf. neu starten
|
||||
$isAdmin = ([Security.Principal.WindowsPrincipal] `
|
||||
[Security.Principal.WindowsIdentity]::GetCurrent() `
|
||||
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||
|
||||
if (-not $isAdmin) {
|
||||
Start-Process powershell.exe `
|
||||
"-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" `
|
||||
-Verb RunAs
|
||||
exit
|
||||
}
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
Write-Host "============================================================"
|
||||
Write-Host " upterm Setup"
|
||||
Write-Host "============================================================"
|
||||
Write-Host ""
|
||||
|
||||
# 1. Execution Policy
|
||||
Write-Host "[1/4] Setze PowerShell Execution Policy..."
|
||||
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
|
||||
Write-Host " OK"
|
||||
|
||||
# 2. Scoop prüfen / installieren
|
||||
Write-Host "[2/4] Pruefe Scoop..."
|
||||
$scoopShims = "$env:USERPROFILE\scoop\shims"
|
||||
$scoopInstalled = (Test-Path "$scoopShims\scoop.ps1") -or (Test-Path "$scoopShims\scoop.cmd")
|
||||
|
||||
if (-not $scoopInstalled) {
|
||||
Write-Host " Scoop nicht gefunden - wird installiert..."
|
||||
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
|
||||
Write-Host " Scoop installiert."
|
||||
} else {
|
||||
Write-Host " Scoop bereits vorhanden."
|
||||
}
|
||||
|
||||
# PATH dieser Session aktualisieren damit scoop sofort verfuegbar ist
|
||||
if ($env:PATH -notlike "*$scoopShims*") {
|
||||
$env:PATH = "$env:PATH;$scoopShims"
|
||||
}
|
||||
|
||||
# 3. 7zip mit lessmsi-Workaround
|
||||
Write-Host "[3/4] Installiere 7zip via lessmsi..."
|
||||
scoop config use_lessmsi true
|
||||
try {
|
||||
scoop install 7zip 2>&1 | Out-Null
|
||||
} catch {
|
||||
Write-Host " 7zip fehlgeschlagen - bereinige und versuche erneut..."
|
||||
scoop uninstall 7zip 2>$null
|
||||
scoop cache rm 7zip 2>$null
|
||||
Remove-Item -Recurse -Force "$env:USERPROFILE\scoop\apps\7zip" `
|
||||
-ErrorAction SilentlyContinue
|
||||
scoop install 7zip
|
||||
}
|
||||
Write-Host " OK"
|
||||
|
||||
# 4. upterm
|
||||
Write-Host "[4/4] Installiere upterm..."
|
||||
scoop bucket add upterm https://github.com/owenthereal/scoop-upterm 2>&1 | Out-Null
|
||||
scoop install upterm
|
||||
Write-Host " OK"
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "============================================================"
|
||||
Write-Host " Installation abgeschlossen!"
|
||||
Write-Host "============================================================"
|
||||
Write-Host ""
|
||||
Write-Host " PowerShell NEU STARTEN, dann Session teilen mit:"
|
||||
Write-Host ""
|
||||
Write-Host " upterm host --server ssh://upterm.ebesch.de:2222 --accept"
|
||||
Write-Host ""
|
||||
Write-Host " Client verbindet sich mit:"
|
||||
Write-Host " ssh TOKEN:HASH@upterm.ebesch.de -p 2222"
|
||||
Write-Host ""
|
||||
Read-Host "Enter zum Beenden"
|
||||
Reference in New Issue
Block a user