<# .SYNOPSIS Creates a portable FileZilla Server environment (no installation required). .DESCRIPTION Downloads the latest FileZilla Server, extracts binaries, and sets up portable config. .NOTES Run as Administrator only once. The resulting folder is fully portable. #> $portableRoot = "$env:USERPROFILE\Desktop\FileZillaServerPortable" $tempDir = "$env:TEMP\fz_portable" $serverDir = "$portableRoot\Server" New-Item -ItemType Directory -Force -Path $tempDir | Out-Null New-Item -ItemType Directory -Force -Path $serverDir | Out-Null 1. Get latest FileZilla Server download URL (official) Write-Host "Fetching latest FileZilla Server URL..." -ForegroundColor Cyan $releasePage = Invoke-WebRequest -Uri "https://filezilla-project.org/download.php?show_all=1&type=server" -UseBasicParsing $downloadLink = ($releasePage.Links | Where-Object $ .href -like "*/FileZilla_Server *_win64-setup.exe" | Select-Object -First 1).href if (-not $downloadLink) Write-Error "Could not find download link. Please download manually from https://filezilla-project.org/download.php?type=server" exit 1
$stopScript = @' @echo off echo Stopping FileZilla Server process... taskkill /f /im filezilla-server.exe >nul 2>&1 taskkill /f /im "FileZilla Server.exe" >nul 2>&1 echo Stopped. '@ filezilla server portable
$installerPath = "$tempDir\FileZillaServerSetup.exe" Write-Host "Downloading from $downloadLink" -ForegroundColor Cyan Invoke-WebRequest -Uri $downloadLink -OutFile $installerPath Write-Host "Extracting files..." -ForegroundColor Cyan Expand-Archive -Path $installerPath -DestinationPath $tempDir -Force -ErrorAction SilentlyContinue if (-not (Test-Path "$tempDir\resources")) # Alternative: use Windows built-in extractor for NSIS? No. Let's use 7z via download if needed. Write-Host "Standard extraction failed. Downloading 7zip standalone..." -ForegroundColor Yellow $7zUrl = "https://www.7-zip.org/a/7zr.exe" $7zExe = "$tempDir\7zr.exe" Invoke-WebRequest -Uri $7zUrl -OutFile $7zExe & $7zExe x $installerPath -o"$tempDir\extracted" -y else $extractSrc = $tempDir 3. Copy required binaries Write-Host "Copying portable server files..." -ForegroundColor Cyan $binaries = @( "FileZilla Server.exe", "filezilla-server.exe", "filezilla-server-config-converter.exe" ) foreach ($bin in $binaries) Select-Object -First 1 if ($found) Copy-Item -Path $found.FullName -Destination $serverDir -Force Write-Host " Copied $bin" -ForegroundColor Green else Write-Warning " Missing: $bin" The resulting folder is fully portable