$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 File ===" -ForegroundColor Cyan if (Test-Path "C:\Shares\test\_SYNC_STATUS.txt") { Get-Content "C:\Shares\test\_SYNC_STATUS.txt" } else { Write-Host "Status file not found" -ForegroundColor Red } Write-Host "" Write-Host "=== Last 30 lines of Sync Log ===" -ForegroundColor Cyan if (Test-Path "C:\Shares\test\scripts\sync-from-nas.log") { Get-Content "C:\Shares\test\scripts\sync-from-nas.log" | Select-Object -Last 30 } else { Write-Host "Log file not found" -ForegroundColor Red } }