# Check if sync is running and show recent log output $password = ConvertTo-SecureString "Paper123!@#" -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential("INTRANET\sysadmin", $password) Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock { Write-Host "=== Sync Status Check ===" -ForegroundColor Cyan Write-Host "" # Check for running PowerShell processes with Sync-FromNAS $syncProcesses = Get-Process powershell -ErrorAction SilentlyContinue | Where-Object { $_.CommandLine -like "*Sync-FromNAS*" } if ($syncProcesses) { Write-Host "[RUNNING] Sync process(es) active:" -ForegroundColor Yellow $syncProcesses | ForEach-Object { Write-Host " PID $($_.Id) - Started: $($_.StartTime)" -ForegroundColor Gray } } else { Write-Host "[IDLE] No sync processes running" -ForegroundColor Green } Write-Host "" Write-Host "Recent log output (last 30 lines):" -ForegroundColor Cyan Write-Host "=" * 80 -ForegroundColor Gray Get-Content "C:\Shares\test\scripts\sync-from-nas.log" -Tail 30 | ForEach-Object { if ($_ -match "ERROR|error") { Write-Host $_ -ForegroundColor Red } elseif ($_ -match "Pushed|Pulled") { Write-Host $_ -ForegroundColor Green } elseif ($_ -match "Starting|Complete") { Write-Host $_ -ForegroundColor Cyan } else { Write-Host $_ -ForegroundColor Gray } } }