# Trigger sync to push files to NAS immediately
$password = ConvertTo-SecureString "Paper123!@#" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential("INTRANET\sysadmin", $password)

Write-Host "=== Triggering Sync to Push BAT Files ===" -ForegroundColor Cyan
Write-Host ""

Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
    Write-Host "[1] Running sync script..." -ForegroundColor Yellow

    # Run the sync script which will push all files to NAS
    & powershell.exe -ExecutionPolicy Bypass -File "C:\Shares\test\scripts\Sync-FromNAS.ps1"

    Write-Host ""
    Write-Host "[OK] Sync complete" -ForegroundColor Green
}

Write-Host ""
Write-Host "=== Complete ===" -ForegroundColor Cyan
Write-Host "[INFO] All BAT files now pushed to NAS" -ForegroundColor Green
Write-Host "[INFO] Available on DOS machines at T:\ drive" -ForegroundColor Green
