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:
58
clients/dataforth/scripts/create-ssh-wrapper.ps1
Normal file
58
clients/dataforth/scripts/create-ssh-wrapper.ps1
Normal file
@@ -0,0 +1,58 @@
|
||||
$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force
|
||||
$cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password)
|
||||
|
||||
Write-Host "Creating SSH wrapper script on AD2..." -ForegroundColor Cyan
|
||||
|
||||
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
|
||||
# Create a local test script that will run SSH without PowerShell remoting overhead
|
||||
$testScript = @'
|
||||
@echo off
|
||||
REM SSH Test Script - Run locally on AD2
|
||||
echo Testing SSH from AD2 to NAS...
|
||||
echo.
|
||||
|
||||
echo [1] Testing hostname...
|
||||
C:\Progra~1\OpenSSH\ssh.exe -o ConnectTimeout=5 -o BatchMode=yes -o StrictHostKeyChecking=no root@192.168.0.9 "hostname"
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
echo [OK] SSH Works!
|
||||
) else (
|
||||
echo [ERROR] SSH Failed with exit code: %ERRORLEVEL%
|
||||
)
|
||||
|
||||
echo.
|
||||
echo [2] Testing find command...
|
||||
C:\Progra~1\OpenSSH\ssh.exe -o ConnectTimeout=10 -o BatchMode=yes -o StrictHostKeyChecking=no root@192.168.0.9 "find /data/test/TS-4R/LOGS -name '*.DAT' -type f 2>/dev/null | head -3"
|
||||
|
||||
echo.
|
||||
echo [3] Running sync script manually...
|
||||
powershell.exe -ExecutionPolicy Bypass -File "C:\Shares\test\scripts\Sync-FromNAS.ps1"
|
||||
'@
|
||||
|
||||
$scriptPath = "C:\Temp\test-ssh-local.bat"
|
||||
New-Item -Path "C:\Temp" -ItemType Directory -Force | Out-Null
|
||||
$testScript | Out-File -FilePath $scriptPath -Encoding ASCII -Force
|
||||
|
||||
Write-Host "[OK] Created test script at: $scriptPath" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "Now running the script locally..." -ForegroundColor Yellow
|
||||
|
||||
# Run it using Task Scheduler to execute in local context
|
||||
$action = New-ScheduledTaskAction -Execute "cmd.exe" -Argument "/c $scriptPath > C:\Temp\ssh-test-output.txt 2>&1"
|
||||
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date).AddSeconds(5)
|
||||
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
|
||||
|
||||
Register-ScheduledTask -TaskName "TestSSH-Temp" -Action $action -Trigger $trigger -Settings $settings -User "SYSTEM" -Force | Out-Null
|
||||
|
||||
Write-Host "Waiting for task to complete..." -ForegroundColor Yellow
|
||||
Start-Sleep -Seconds 15
|
||||
|
||||
if (Test-Path "C:\Temp\ssh-test-output.txt") {
|
||||
Write-Host ""
|
||||
Write-Host "========== OUTPUT ==========" -ForegroundColor Cyan
|
||||
Get-Content "C:\Temp\ssh-test-output.txt"
|
||||
Write-Host "=============================" -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
# Cleanup
|
||||
Unregister-ScheduledTask -TaskName "TestSSH-Temp" -Confirm:$false -ErrorAction SilentlyContinue
|
||||
}
|
||||
Reference in New Issue
Block a user