Files
claudetools/clients/dataforth/scripts/run-sync-direct.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

61 lines
2.3 KiB
PowerShell

# Run sync directly and capture detailed output
$password = ConvertTo-SecureString "Paper123!@#" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential("INTRANET\sysadmin", $password)
Write-Host "=== Running Sync Directly ===" -ForegroundColor Cyan
Write-Host ""
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
$scriptPath = "C:\Shares\test\scripts\Sync-FromNAS.ps1"
$logFile = "C:\Shares\test\scripts\sync-from-nas.log"
Write-Host "[1] Getting log position" -ForegroundColor Yellow
$logSize = (Get-Item $logFile).Length
Write-Host "[2] Running sync..." -ForegroundColor Yellow
Write-Host ""
# Run sync and capture output
& powershell.exe -ExecutionPolicy Bypass -File $scriptPath 2>&1 | Out-Null
Write-Host "[3] Checking new log entries for SCP errors" -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Gray
Start-Sleep -Seconds 2
$newLogSize = (Get-Item $logFile).Length
$newBytes = $newLogSize - $logSize
if ($newBytes -gt 0) {
$allContent = Get-Content $logFile -Raw
$newContent = $allContent.Substring([math]::Max(0, $allContent.Length - $newBytes - 500))
# Look specifically for SCP PUSH ERROR
$scpErrors = $newContent -split "`n" | Where-Object { $_ -match "SCP PUSH ERROR" }
if ($scpErrors) {
Write-Host "[SUCCESS] Found detailed SCP errors!" -ForegroundColor Green
Write-Host ""
$scpErrors | ForEach-Object {
Write-Host $_ -ForegroundColor Red
}
} else {
# Show all errors
Write-Host "[INFO] No 'SCP PUSH ERROR' found. Showing all errors:" -ForegroundColor Yellow
Write-Host ""
$allErrors = $newContent -split "`n" | Where-Object { $_ -match "ERROR" }
if ($allErrors) {
$allErrors | Select-Object -First 10 | ForEach-Object {
Write-Host $_ -ForegroundColor Red
}
} else {
Write-Host "[INFO] No errors in this sync run!" -ForegroundColor Green
}
}
} else {
Write-Host "[WARNING] No new log entries detected" -ForegroundColor Yellow
}
}
Write-Host ""
Write-Host "=== Sync Complete ===" -ForegroundColor Cyan