$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 "=== Scheduled Task Info ===" -ForegroundColor Cyan Get-ScheduledTask -TaskName "*Sync*" -ErrorAction SilentlyContinue | ForEach-Object { $task = $_ $info = Get-ScheduledTaskInfo -TaskName $task.TaskName -ErrorAction SilentlyContinue Write-Host "`nTask: $($task.TaskName)" -ForegroundColor Yellow Write-Host "State: $($task.State)" Write-Host "Last Run: $($info.LastRunTime)" Write-Host "Last Result: $($info.LastTaskResult)" Write-Host "Next Run: $($info.NextRunTime)" } }