$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password) Write-Host "Testing SSH After Agent Fix..." -ForegroundColor Cyan Write-Host "" Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock { Write-Host "[1] Quick hostname test..." -ForegroundColor Yellow $result = & ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@192.168.0.9 "hostname" 2>&1 Write-Host " Result: $result" -ForegroundColor $(if ($LASTEXITCODE -eq 0) { "Green" } else { "Red" }) Write-Host " Exit code: $LASTEXITCODE" -ForegroundColor White Write-Host "" Write-Host "[2] Testing find command (what was hanging sync)..." -ForegroundColor Yellow $findResult = & ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no root@192.168.0.9 "find /data/test/TS-4R/LOGS -name '*.DAT' -type f 2>/dev/null | head -3" 2>&1 if ($LASTEXITCODE -eq 0) { Write-Host " [OK] Find command worked!" -ForegroundColor Green Write-Host " Sample files: $($findResult -join ', ')" -ForegroundColor Gray } else { Write-Host " [ERROR] Find command failed: $findResult" -ForegroundColor Red } Write-Host "" Write-Host "[3] Testing SCP..." -ForegroundColor Yellow $testFile = "$env:TEMP\scp_test.txt" "TEST" | Out-File $testFile -Encoding ASCII $scpResult = & scp -o ConnectTimeout=5 -o StrictHostKeyChecking=no $testFile root@192.168.0.9:/tmp/ 2>&1 if ($LASTEXITCODE -eq 0) { Write-Host " [OK] SCP worked!" -ForegroundColor Green } else { Write-Host " [ERROR] SCP failed: $scpResult" -ForegroundColor Red } Remove-Item $testFile -ErrorAction SilentlyContinue }