# Check SCP command details in sync script

$Username = "INTRANET\sysadmin"
$Password = ConvertTo-SecureString "Paper123!@#" -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential($Username, $Password)

Write-Host "[INFO] Finding SCP commands in Sync-FromNAS.ps1..."

$SCPCommands = Invoke-Command -ComputerName 192.168.0.6 -Credential $Cred -ScriptBlock {
    Get-Content 'C:\Shares\test\scripts\Sync-FromNAS.ps1' | Select-String -Pattern '\$SCP ' -Context 0
}

Write-Host ""
Write-Host "[INFO] SCP commands found:"
$SCPCommands | ForEach-Object { Write-Host $_ }

Write-Host ""
Write-Host "[INFO] Analysis:"
Write-Host "OpenSSH scp can convert line endings in text mode."
Write-Host "Solution: Add -O flag to use legacy SCP protocol (binary mode)"
Write-Host "Or: Add -T flag to disable pseudo-terminal"
