# WEVAL GWS Auto-Setup — Run in PowerShell as Admin # Uses Service Account from S204 (no browser OAuth needed) Write-Host "=== WEVAL GWS Setup ===" -ForegroundColor Cyan # 1. Install GWS CLI Write-Host "Installing GWS CLI..." -ForegroundColor Yellow npm install -g @googleworkspace/cli # 2. Download SA from S204 Write-Host "Downloading Service Account..." -ForegroundColor Yellow $saUrl = "https://weval-consulting.com/api/google-api.php?action=test" $sa = Invoke-RestMethod -Uri $saUrl -Method GET Write-Host "SA Project: $($sa.project)" -ForegroundColor Green Write-Host "SA Email: $($sa.email)" -ForegroundColor Green # 3. Configure GWS with SA $env:GOOGLE_APPLICATION_CREDENTIALS = "$HOME\.config\gcloud\weval-sa.json" New-Item -ItemType Directory -Force -Path "$HOME\.config\gcloud" | Out-Null # Download SA key file from S204 $droidUrl = "https://weval-consulting.com/api/droid" $cmd = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("cat /var/www/weval/gcloud-sa.json")) $body = @{k="DROID2026"; c=$cmd} $resp = Invoke-RestMethod -Uri $droidUrl -Method POST -Body $body $resp.output | Set-Content "$HOME\.config\gcloud\weval-sa.json" Write-Host "SA saved to $HOME\.config\gcloud\weval-sa.json" -ForegroundColor Green # 4. Test Write-Host "`nTesting GWS..." -ForegroundColor Yellow gws --version Write-Host "`n=== Setup Complete ===" -ForegroundColor Cyan Write-Host "Run: gws auth login" -ForegroundColor White Write-Host "Then: gws drive files list --params '{""pageSize"": 5}'" -ForegroundColor White