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>
106 lines
3.9 KiB
PowerShell
106 lines
3.9 KiB
PowerShell
# Get detailed sync error messages
|
|
Write-Host "=== Analyzing Sync Error Details ===" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
$password = ConvertTo-SecureString "Paper123!@#" -AsPlainText -Force
|
|
$cred = New-Object System.Management.Automation.PSCredential("INTRANET\sysadmin", $password)
|
|
|
|
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
|
|
$logFile = "C:\Shares\test\scripts\sync-from-nas.log"
|
|
|
|
Write-Host "Looking for detailed error messages..." -ForegroundColor Yellow
|
|
Write-Host ""
|
|
|
|
# Get context around errors (lines before and after ERROR lines)
|
|
$content = Get-Content $logFile -Tail 2000
|
|
|
|
Write-Host "[1] Error Context (last 20 errors with surrounding lines)" -ForegroundColor Yellow
|
|
Write-Host "=" * 80 -ForegroundColor Gray
|
|
Write-Host ""
|
|
|
|
$errorIndices = @()
|
|
for ($i = 0; $i -lt $content.Count; $i++) {
|
|
if ($content[$i] -match "ERROR:") {
|
|
$errorIndices += $i
|
|
}
|
|
}
|
|
|
|
# Show last 20 errors with context
|
|
$errorIndices | Select-Object -Last 20 | ForEach-Object {
|
|
$index = $_
|
|
|
|
# Show 2 lines before, the error, and 2 lines after
|
|
$start = [Math]::Max(0, $index - 2)
|
|
$end = [Math]::Min($content.Count - 1, $index + 2)
|
|
|
|
for ($i = $start; $i -le $end; $i++) {
|
|
if ($i -eq $index) {
|
|
Write-Host ">>> $($content[$i])" -ForegroundColor Red
|
|
} else {
|
|
Write-Host " $($content[$i])" -ForegroundColor Gray
|
|
}
|
|
}
|
|
Write-Host ""
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "[2] Checking for specific error messages" -ForegroundColor Yellow
|
|
Write-Host "=" * 80 -ForegroundColor Gray
|
|
|
|
# Look for common error patterns in more detail
|
|
$sshErrors = $content | Select-String -Pattern "ssh|plink|pscp" -Context 0,1
|
|
$permErrors = $content | Select-String -Pattern "denied|permission" -Context 0,1
|
|
$fileErrors = $content | Select-String -Pattern "not found|no such|cannot find" -Context 0,1
|
|
$networkErrors = $content | Select-String -Pattern "timeout|connection|network" -Context 0,1
|
|
|
|
if ($sshErrors) {
|
|
Write-Host "SSH/Connection Errors:" -ForegroundColor Red
|
|
$sshErrors | Select-Object -First 5 | ForEach-Object {
|
|
Write-Host " $($_.Line)" -ForegroundColor Red
|
|
}
|
|
Write-Host ""
|
|
}
|
|
|
|
if ($permErrors) {
|
|
Write-Host "Permission Errors:" -ForegroundColor Red
|
|
$permErrors | Select-Object -First 5 | ForEach-Object {
|
|
Write-Host " $($_.Line)" -ForegroundColor Red
|
|
}
|
|
Write-Host ""
|
|
}
|
|
|
|
if ($fileErrors) {
|
|
Write-Host "File Not Found Errors:" -ForegroundColor Red
|
|
$fileErrors | Select-Object -First 5 | ForEach-Object {
|
|
Write-Host " $($_.Line)" -ForegroundColor Red
|
|
}
|
|
Write-Host ""
|
|
}
|
|
|
|
if ($networkErrors) {
|
|
Write-Host "Network/Timeout Errors:" -ForegroundColor Red
|
|
$networkErrors | Select-Object -First 5 | ForEach-Object {
|
|
Write-Host " $($_.Line)" -ForegroundColor Red
|
|
}
|
|
Write-Host ""
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "[3] Checking one of the failing files" -ForegroundColor Yellow
|
|
Write-Host "=" * 80 -ForegroundColor Gray
|
|
|
|
# Check if one of the failing files actually exists
|
|
$testFile = "C:\Shares\test\TS-11L\ProdSW\HVDATA\hvin.dat"
|
|
if (Test-Path $testFile) {
|
|
$file = Get-Item $testFile
|
|
Write-Host "Sample failing file EXISTS on AD2:" -ForegroundColor Green
|
|
Write-Host " Path: $($file.FullName)" -ForegroundColor White
|
|
Write-Host " Size: $($file.Length) bytes" -ForegroundColor White
|
|
Write-Host " Modified: $($file.LastWriteTime)" -ForegroundColor White
|
|
Write-Host ""
|
|
Write-Host "This suggests the issue is with the PUSH to NAS, not the source file." -ForegroundColor Yellow
|
|
} else {
|
|
Write-Host "Sample file does NOT exist: $testFile" -ForegroundColor Red
|
|
}
|
|
}
|