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>
74 lines
3.0 KiB
PowerShell
74 lines
3.0 KiB
PowerShell
# Verify the error logging is working and check where generic errors come from
|
|
$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 {
|
|
$scriptPath = "C:\Shares\test\scripts\Sync-FromNAS.ps1"
|
|
$content = Get-Content $scriptPath
|
|
|
|
Write-Host "=== Verification Check ===" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
Write-Host "[1] Copy-ToNAS function (lines 82-97)" -ForegroundColor Yellow
|
|
Write-Host "=" * 80 -ForegroundColor Gray
|
|
for ($i = 81; $i -le 96; $i++) {
|
|
if ($content[$i] -match 'SCP PUSH ERROR') {
|
|
Write-Host "$($i+1): $($content[$i])" -ForegroundColor Green
|
|
} else {
|
|
Write-Host "$($i+1): $($content[$i])" -ForegroundColor Gray
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "[2] Generic error logging locations" -ForegroundColor Yellow
|
|
Write-Host "=" * 80 -ForegroundColor Gray
|
|
|
|
$genericErrorLines = @()
|
|
for ($i = 0; $i -lt $content.Count; $i++) {
|
|
if ($content[$i] -match 'Write-Log.*ERROR: Failed to push') {
|
|
$genericErrorLines += $i
|
|
Write-Host "Line $($i+1): $($content[$i])" -ForegroundColor Red
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "[3] Analysis" -ForegroundColor Yellow
|
|
Write-Host "=" * 80 -ForegroundColor Gray
|
|
|
|
if ($genericErrorLines.Count -gt 0) {
|
|
Write-Host "[FOUND] $($genericErrorLines.Count) generic error logging location(s)" -ForegroundColor Yellow
|
|
Write-Host ""
|
|
Write-Host "These generic errors are logged by the CALLING CODE," -ForegroundColor Yellow
|
|
Write-Host "which happens AFTER Copy-ToNAS returns false." -ForegroundColor Yellow
|
|
Write-Host ""
|
|
Write-Host "The detailed SCP errors should appear BEFORE the generic errors." -ForegroundColor Cyan
|
|
Write-Host "Example expected log sequence:" -ForegroundColor Gray
|
|
Write-Host " SCP PUSH ERROR (exit 1): scp: /data/test/path: Permission denied" -ForegroundColor Red
|
|
Write-Host " ERROR: Failed to push filename.dat" -ForegroundColor Red
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "[4] Recent error examples from log" -ForegroundColor Yellow
|
|
Write-Host "=" * 80 -ForegroundColor Gray
|
|
|
|
$logFile = "C:\Shares\test\scripts\sync-from-nas.log"
|
|
$recentErrors = Get-Content $logFile -Tail 1000 | Where-Object {
|
|
$_ -match "Failed to push.*hvin\.dat" -or $_ -match "Failed to push.*hvsort\.dat" -or $_ -match "SCP PUSH ERROR"
|
|
}
|
|
|
|
if ($recentErrors) {
|
|
$recentErrors | Select-Object -Last 10 | ForEach-Object {
|
|
if ($_ -match "SCP PUSH ERROR") {
|
|
Write-Host $_ -ForegroundColor Green
|
|
} else {
|
|
Write-Host $_ -ForegroundColor Red
|
|
}
|
|
}
|
|
} else {
|
|
Write-Host "[INFO] No relevant errors found in recent log" -ForegroundColor Yellow
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "=== Verification Complete ===" -ForegroundColor Cyan
|