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>
This commit is contained in:
2026-03-20 17:15:07 -07:00
parent 98ea867d2c
commit 5cbd49ce24
207 changed files with 49 additions and 547 deletions

View File

@@ -0,0 +1,83 @@
$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password)
Write-Host "Recreating Sync-FromNAS Task..." -ForegroundColor Cyan
Write-Host ""
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
# Task parameters
$taskName = "Sync-FromNAS"
$scriptPath = "C:\Shares\test\scripts\Sync-FromNAS.ps1"
$logPath = "C:\Shares\test\scripts\sync-from-nas.log"
$taskUser = "INTRANET\sysadmin"
$taskPassword = 'Paper123!@#'
# Remove existing task if it exists
Unregister-ScheduledTask -TaskName $taskName -Confirm:$false -ErrorAction SilentlyContinue
Write-Host "[1] Creating task action..." -ForegroundColor Yellow
$action = New-ScheduledTaskAction `
-Execute "powershell.exe" `
-Argument "-ExecutionPolicy Bypass -NonInteractive -File `"$scriptPath`"" `
-WorkingDirectory "C:\Shares\test\scripts"
Write-Host "[2] Creating task trigger (every 15 minutes)..." -ForegroundColor Yellow
$trigger = New-ScheduledTaskTrigger `
-Once `
-At (Get-Date).AddMinutes(1) `
-RepetitionInterval (New-TimeSpan -Minutes 15) `
-RepetitionDuration ([TimeSpan]::MaxValue)
Write-Host "[3] Creating task settings..." -ForegroundColor Yellow
$settings = New-ScheduledTaskSettingsSet `
-AllowStartIfOnBatteries `
-DontStopIfGoingOnBatteries `
-StartWhenAvailable `
-ExecutionTimeLimit (New-TimeSpan -Minutes 30) `
-RestartCount 3 `
-RestartInterval (New-TimeSpan -Minutes 1)
Write-Host "[4] Registering task as $taskUser..." -ForegroundColor Yellow
Register-ScheduledTask `
-TaskName $taskName `
-Action $action `
-Trigger $trigger `
-Settings $settings `
-User $taskUser `
-Password $taskPassword `
-RunLevel Highest `
-Description "Sync test data and software updates between NAS and AD2" `
-Force | Out-Null
Write-Host " [OK] Task created successfully" -ForegroundColor Green
Write-Host ""
Write-Host "[5] Verifying task..." -ForegroundColor Yellow
$task = Get-ScheduledTask -TaskName $taskName
Write-Host " User: $($task.Principal.UserId)" -ForegroundColor White
Write-Host " State: $($task.State)" -ForegroundColor White
Write-Host ""
Write-Host "[6] Starting task now..." -ForegroundColor Yellow
Start-ScheduledTask -TaskName $taskName
Write-Host " Waiting 25 seconds for sync to complete..." -ForegroundColor White
Start-Sleep -Seconds 25
Write-Host ""
Write-Host "[7] Checking results..." -ForegroundColor Yellow
$taskInfo = Get-ScheduledTaskInfo -TaskName $taskName
Write-Host " Last Run: $($taskInfo.LastRunTime)" -ForegroundColor White
Write-Host " Last Result: 0x$($taskInfo.LastTaskResult.ToString('X')) $(if ($taskInfo.LastTaskResult -eq 0) { '(SUCCESS)' } else { '(FAILED)' })" -ForegroundColor $(if ($taskInfo.LastTaskResult -eq 0) { "Green" } else { "Red" })
Write-Host " Next Run: $($taskInfo.NextRunTime)" -ForegroundColor White
Write-Host ""
Write-Host "[8] Last 20 lines of sync log..." -ForegroundColor Yellow
if (Test-Path $logPath) {
Get-Content $logPath | Select-Object -Last 20 | ForEach-Object { Write-Host " $_" -ForegroundColor Gray }
}
}
Write-Host ""
Write-Host "================================================" -ForegroundColor Cyan
Write-Host "Task Recreation Complete" -ForegroundColor Cyan
Write-Host "================================================" -ForegroundColor Cyan