Files
claudetools/clients/dataforth/scripts/verify-and-test-sync.ps1
Mike Swanson 5cbd49ce24 Reorganize repo: compartmentalize scripts by client/project
Move 150+ scripts from root and scripts/ into client/project directories:
- clients/dataforth/scripts/ (110 files: AD2, sync, SSH, DB, DOS scripts)
- clients/bg-builders/scripts/ (14 files: Lesley mgmt, Exchange, termination)
- clients/internal-infrastructure/scripts/ (10 files: GDAP, Gitea, backups)
- projects/msp-tools/scripts/ (9 files: CIPP, MSP onboarding, Datto)
- projects/gururmm-agent/scripts/ (3 files: API test, JWT, record counts)
- clients/glaztech/scripts/ (1 file: CentraStage removal)

Also reorganized:
- VPN scripts → infrastructure/vpn-configs/
- Retrieved API/JS files → api/
- Forum posts → projects/community-forum/forum-posts/
- SSH docs → clients/internal-infrastructure/docs/
- NWTOC/CTONW docs → projects/wrightstown-smarthome/docs/
- ACG website files → projects/internal/acg-website-2025/
- Dataforth docs → clients/dataforth/docs/
- schema-retrieved.sql → docs/database/

Deleted 24 tmp_*.ps1 one-off debug scripts (preserved in git history).
Root reduced from 220+ files to 62 items (docs + directories only).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 17:15:07 -07:00

81 lines
3.1 KiB
PowerShell

# Verify the sync script update and run a test sync
$password = ConvertTo-SecureString "Paper123!@#" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential("INTRANET\sysadmin", $password)
Write-Host "=== Verifying Sync Script Update ===" -ForegroundColor Cyan
Write-Host ""
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
$scriptPath = "C:\Shares\test\scripts\Sync-FromNAS.ps1"
Write-Host "[1] Verifying OpenSSH tool paths" -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Gray
$content = Get-Content $scriptPath -Raw
if ($content -match '\$SCP\s*=\s*"[^"]*OpenSSH[^"]*scp\.exe"') {
Write-Host "[OK] SCP path updated to OpenSSH" -ForegroundColor Green
} else {
Write-Host "[ERROR] SCP path not found or incorrect" -ForegroundColor Red
}
if ($content -match '\$SSH\s*=\s*"[^"]*OpenSSH[^"]*ssh\.exe"') {
Write-Host "[OK] SSH path updated to OpenSSH" -ForegroundColor Green
} else {
Write-Host "[ERROR] SSH path not found or incorrect" -ForegroundColor Red
}
Write-Host ""
Write-Host "[2] Verifying Copy-ToNAS function" -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Gray
if ($content -match "SCP PUSH ERROR") {
Write-Host "[OK] Copy-ToNAS has error logging" -ForegroundColor Green
} else {
Write-Host "[WARNING] Error logging may not be present" -ForegroundColor Yellow
}
if ($content -match "StrictHostKeyChecking=accept-new") {
Write-Host "[OK] Auto host key acceptance configured" -ForegroundColor Green
} else {
Write-Host "[WARNING] Host key acceptance may not be configured" -ForegroundColor Yellow
}
Write-Host ""
Write-Host "[3] Running manual sync test" -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Gray
Write-Host "Triggering a manual sync run to test OpenSSH and capture errors..." -ForegroundColor White
Write-Host ""
# Run the sync script
try {
& powershell.exe -ExecutionPolicy Bypass -File $scriptPath *>&1 | Tee-Object -Variable syncOutput
Write-Host ""
Write-Host "[4] Checking sync log for detailed errors" -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Gray
$logFile = "C:\Shares\test\scripts\sync-from-nas.log"
$recentErrors = Get-Content $logFile -Tail 30 | Select-String -Pattern "SCP.*ERROR|ERROR.*push|ERROR.*pull"
if ($recentErrors) {
Write-Host "Found detailed error messages:" -ForegroundColor Cyan
$recentErrors | ForEach-Object {
Write-Host " $_" -ForegroundColor Red
}
} else {
Write-Host "No detailed SCP errors found in recent log" -ForegroundColor Yellow
Write-Host "Showing last 15 lines of log:" -ForegroundColor Gray
Get-Content $logFile -Tail 15 | ForEach-Object {
Write-Host " $_" -ForegroundColor Gray
}
}
} catch {
Write-Host "[ERROR] Sync script failed to run: $($_.Exception.Message)" -ForegroundColor Red
}
}
Write-Host ""
Write-Host "=== Test Complete ===" -ForegroundColor Cyan