$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password) Write-Host "================================================" -ForegroundColor Cyan Write-Host "Triggering Sync Script on AD2" -ForegroundColor Cyan Write-Host "================================================" -ForegroundColor Cyan Write-Host "" Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock { Write-Host "Running Sync-FromNAS.ps1..." -ForegroundColor Yellow Write-Host "" # Run the sync script & "C:\Shares\test\scripts\Sync-FromNAS.ps1" Write-Host "" Write-Host "Sync complete!" -ForegroundColor Green Write-Host "" # Show sync status if (Test-Path "C:\Shares\test\_SYNC_STATUS.txt") { Write-Host "=== Sync Status ===" -ForegroundColor Yellow Get-Content "C:\Shares\test\_SYNC_STATUS.txt" | Select-Object -Last 10 } } Write-Host "" Write-Host "================================================" -ForegroundColor Green Write-Host "Sync Triggered Successfully" -ForegroundColor Green Write-Host "================================================" -ForegroundColor Green