56 lines
1.5 KiB
PowerShell
56 lines
1.5 KiB
PowerShell
# Deploy BAT files directly to NAS with CRLF preservation
|
|
|
|
$BATFiles = @(
|
|
"DEPLOY.BAT",
|
|
"UPDATE.BAT",
|
|
"NWTOC.BAT",
|
|
"CTONW.BAT",
|
|
"CHECKUPD.BAT",
|
|
"REBOOT.BAT"
|
|
)
|
|
|
|
Write-Host "[INFO] Deploying BAT files directly to NAS..."
|
|
Write-Host "[INFO] Using SCP with -O flag (binary mode, preserves CRLF)"
|
|
Write-Host ""
|
|
|
|
$SuccessCount = 0
|
|
$TotalFiles = 0
|
|
|
|
foreach ($File in $BATFiles) {
|
|
if (Test-Path $File) {
|
|
Write-Host " Deploying: $File"
|
|
|
|
# Verify CRLF before sending
|
|
$Content = Get-Content $File -Raw
|
|
if ($Content -match "`r`n") {
|
|
$Size = (Get-Item $File).Length
|
|
Write-Host " Size: $Size bytes (with CRLF)"
|
|
|
|
# Copy to NAS root (/data/test/)
|
|
$result = & 'C:\Windows\System32\OpenSSH\scp.exe' -O $File root@192.168.0.9:/data/test/ 2>&1
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host " [SUCCESS] Copied to /data/test/$File"
|
|
$SuccessCount++
|
|
} else {
|
|
Write-Host " [ERROR] Failed: $result"
|
|
}
|
|
} else {
|
|
Write-Host " [ERROR] No CRLF found - skipping"
|
|
}
|
|
|
|
$TotalFiles++
|
|
Write-Host ""
|
|
} else {
|
|
Write-Host " [WARNING] $File not found"
|
|
Write-Host ""
|
|
}
|
|
}
|
|
|
|
Write-Host "[COMPLETE] Direct deployment to NAS"
|
|
Write-Host " Files processed: $TotalFiles"
|
|
Write-Host " Files deployed: $SuccessCount"
|
|
Write-Host ""
|
|
Write-Host "[INFO] Files are now available at T:\ for DOS machines"
|
|
Write-Host "[INFO] Test DEPLOY.BAT on a DOS machine to verify CRLF"
|