try { $ErrorActionPreference = "Stop" Write-Host "1. Building binary exec file..." -ForegroundColor Cyan & "C:\Users\wddsh\go\bin\gox.exe" -osarch="linux/amd64" -output "build/agent-wdd_{{.OS}}_{{.Arch}}" # 执行远程ssh命令 ssh root@192.168.35.71 "rm /root/agent-wdd_linux_amd64" Write-Host "2. Cleaning old binary file..." -ForegroundColor Yellow ssh root@192.168.35.71 "rm -f /root/agent-wdd_linux_amd64 && rm /usr/local/etc/wdd/agent-wdd-config.yaml" Write-Host "3. Uploading binary exec..." -ForegroundColor Green scp build/agent-wdd_linux_amd64 root@192.168.35.71:/root/ Write-Host "4. Exec the command ..." -ForegroundColor Blue Write-Host "" Write-Host "" ssh root@192.168.35.71 "chmod +x agent-wdd_linux_amd64 && ./agent-wdd_linux_amd64 help" Write-Host "" Write-Host "" Write-Host "5. Cheak Info Result ..." -ForegroundColor Blue ssh root@192.168.35.71 "cat /usr/local/etc/wdd/agent-wdd-config.yaml" } catch { Write-Host "操作失败: $_" -ForegroundColor Red exit 1 }