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>
79 lines
3.0 KiB
PowerShell
79 lines
3.0 KiB
PowerShell
# Test the updated sync script
|
|
$password = ConvertTo-SecureString "Paper123!@#" -AsPlainText -Force
|
|
$cred = New-Object System.Management.Automation.PSCredential("INTRANET\sysadmin", $password)
|
|
|
|
Write-Host "=== Testing Updated Sync Script ===" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
|
|
Write-Host "[1] Running sync script manually..." -ForegroundColor Yellow
|
|
Write-Host "=" * 80 -ForegroundColor Gray
|
|
Write-Host ""
|
|
|
|
# Clear recent errors from log
|
|
$logFile = "C:\Shares\test\scripts\sync-from-nas.log"
|
|
Write-Host "Note: Watching $logFile for new errors..." -ForegroundColor Gray
|
|
Write-Host ""
|
|
|
|
# Get current log size
|
|
$logSize = (Get-Item $logFile).Length
|
|
|
|
# Run sync (in background to avoid blocking)
|
|
$job = Start-Job -ScriptBlock {
|
|
& powershell.exe -ExecutionPolicy Bypass -File "C:\Shares\test\scripts\Sync-FromNAS.ps1"
|
|
}
|
|
|
|
# Wait a bit for it to start
|
|
Start-Sleep -Seconds 10
|
|
|
|
# Check for new log entries
|
|
$newContent = Get-Content $logFile -Raw
|
|
$newLines = $newContent.Substring([Math]::Min($logSize, $newContent.Length))
|
|
|
|
Write-Host "[2] Recent log output:" -ForegroundColor Yellow
|
|
Write-Host "=" * 80 -ForegroundColor Gray
|
|
|
|
$newLines -split "`n" | Select-Object -Last 50 | ForEach-Object {
|
|
if ($_ -match "ERROR|error") {
|
|
Write-Host $_ -ForegroundColor Red
|
|
} elseif ($_ -match "WARNING|warning") {
|
|
Write-Host $_ -ForegroundColor Yellow
|
|
} elseif ($_ -match "SCP|scp") {
|
|
Write-Host $_ -ForegroundColor Cyan
|
|
} else {
|
|
Write-Host $_ -ForegroundColor Gray
|
|
}
|
|
}
|
|
|
|
# Stop the job
|
|
Stop-Job -Job $job -ErrorAction SilentlyContinue
|
|
Remove-Job -Job $job -ErrorAction SilentlyContinue
|
|
|
|
Write-Host ""
|
|
Write-Host "[3] Checking if detailed SCP errors are logged" -ForegroundColor Yellow
|
|
Write-Host "=" * 80 -ForegroundColor Gray
|
|
|
|
$scpErrors = Get-Content $logFile -Tail 100 | Select-String -Pattern "SCP ERROR"
|
|
|
|
if ($scpErrors) {
|
|
Write-Host "[SUCCESS] Found detailed SCP error logging!" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "Sample SCP errors:" -ForegroundColor Cyan
|
|
$scpErrors | Select-Object -First 5 | ForEach-Object {
|
|
Write-Host " $_" -ForegroundColor Red
|
|
}
|
|
} else {
|
|
Write-Host "[INFO] No 'SCP ERROR' entries found yet" -ForegroundColor Yellow
|
|
Write-Host "This could mean:" -ForegroundColor Gray
|
|
Write-Host " - No errors occurred (good!)" -ForegroundColor Gray
|
|
Write-Host " - Errors happened but weren't logged yet" -ForegroundColor Gray
|
|
Write-Host " - Need to wait for next scheduled run" -ForegroundColor Gray
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "=== Test Complete ===" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
Write-Host "Note: The script runs every 15 minutes via scheduled task." -ForegroundColor Yellow
|
|
Write-Host "Check the log again in a few minutes for full sync results." -ForegroundColor Yellow
|