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>
62 lines
2.9 KiB
PowerShell
62 lines
2.9 KiB
PowerShell
$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force
|
|
$cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password)
|
|
|
|
Write-Host "================================================" -ForegroundColor Cyan
|
|
Write-Host "Sync Diagnostic Report" -ForegroundColor Cyan
|
|
Write-Host "================================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
|
|
Write-Host "[1] Checking Sync Task Status..." -ForegroundColor Yellow
|
|
$task = Get-ScheduledTask -TaskName "Sync-FromNAS" -ErrorAction SilentlyContinue
|
|
if ($task) {
|
|
Write-Host " State: $($task.State)" -ForegroundColor White
|
|
$taskInfo = Get-ScheduledTaskInfo -TaskName "Sync-FromNAS"
|
|
Write-Host " Last Run: $($taskInfo.LastRunTime)" -ForegroundColor White
|
|
Write-Host " Last Result: 0x$($taskInfo.LastTaskResult.ToString('X'))" -ForegroundColor White
|
|
Write-Host " Next Run: $($taskInfo.NextRunTime)" -ForegroundColor White
|
|
}
|
|
Write-Host ""
|
|
|
|
Write-Host "[2] Checking for Running Sync Processes..." -ForegroundColor Yellow
|
|
$syncProcs = Get-Process -Name pwsh,powershell -ErrorAction SilentlyContinue |
|
|
Where-Object { $_.CommandLine -like "*Sync-FromNAS*" }
|
|
if ($syncProcs) {
|
|
Write-Host " Found $($syncProcs.Count) running sync process(es)" -ForegroundColor Red
|
|
$syncProcs | ForEach-Object {
|
|
Write-Host " PID $($_.Id): Started $($_.StartTime)" -ForegroundColor White
|
|
}
|
|
} else {
|
|
Write-Host " No sync processes running" -ForegroundColor Green
|
|
}
|
|
Write-Host ""
|
|
|
|
Write-Host "[3] Checking commonSources Configuration..." -ForegroundColor Yellow
|
|
$syncScript = Get-Content "C:\Shares\test\scripts\Sync-FromNAS.ps1" -Raw
|
|
if ($syncScript -match '\$commonSources\s*=\s*@\((.*?)\)') {
|
|
Write-Host " Found commonSources config:" -ForegroundColor White
|
|
Write-Host $matches[0] -ForegroundColor Gray
|
|
}
|
|
Write-Host ""
|
|
|
|
Write-Host "[4] Last 10 Sync Log Entries..." -ForegroundColor Yellow
|
|
if (Test-Path "C:\Shares\test\scripts\sync-from-nas.log") {
|
|
Get-Content "C:\Shares\test\scripts\sync-from-nas.log" | Select-Object -Last 10 |
|
|
ForEach-Object { Write-Host " $_" -ForegroundColor Gray }
|
|
}
|
|
Write-Host ""
|
|
|
|
Write-Host "[5] Testing SSH Connection to NAS..." -ForegroundColor Yellow
|
|
$sshTest = ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@192.168.0.9 "echo OK" 2>&1
|
|
if ($sshTest -eq "OK") {
|
|
Write-Host " SSH connection: OK" -ForegroundColor Green
|
|
} else {
|
|
Write-Host " SSH connection: FAILED - $sshTest" -ForegroundColor Red
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "================================================" -ForegroundColor Cyan
|
|
Write-Host "Diagnostic Complete" -ForegroundColor Cyan
|
|
Write-Host "================================================" -ForegroundColor Cyan
|