Files
claudetools/clients/dataforth/scripts/copy-to-nas-now.ps1
Mike Swanson 5cbd49ce24 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>
2026-03-20 17:15:07 -07:00

101 lines
3.9 KiB
PowerShell

# Manually copy fixed BAT files from AD2 to NAS immediately
$password = ConvertTo-SecureString "Paper123!@#" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential("INTRANET\sysadmin", $password)
Write-Host "=== Copying BAT Files to NAS ===" -ForegroundColor Cyan
Write-Host ""
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
$SCP = "C:\Program Files\OpenSSH\scp.exe"
$NAS_IP = "192.168.0.9"
$NAS_USER = "admin"
Write-Host "[1] Copying root-level BAT files to NAS" -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Gray
$rootFiles = @(
"DEPLOY.BAT",
"NWTOC.BAT",
"CTONW.BAT",
"UPDATE.BAT",
"STAGE.BAT",
"CHECKUPD.BAT",
"REBOOT.BAT",
"DOSTEST.BAT"
)
$successCount = 0
$errorCount = 0
foreach ($file in $rootFiles) {
$localPath = "C:\Shares\test\$file"
$remotePath = "/volume1/test/$file"
if (Test-Path $localPath) {
Write-Host "Copying $file..." -ForegroundColor Cyan
$result = & $SCP -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile="C:\Shares\test\scripts\.ssh\known_hosts" -o PreferredAuthentications=password -o PubkeyAuthentication=no -o PasswordAuthentication=yes $localPath "${NAS_USER}@${NAS_IP}:$remotePath" 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host " [OK] $file" -ForegroundColor Green
$successCount++
} else {
Write-Host " [ERROR] $file - $result" -ForegroundColor Red
$errorCount++
}
} else {
Write-Host " [SKIP] $file - not found" -ForegroundColor Yellow
}
}
Write-Host ""
Write-Host "[2] Creating COMMON/DOS directory on NAS" -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Gray
# SSH to NAS and create directory
$SSH = "C:\Program Files\OpenSSH\ssh.exe"
$mkdirResult = & $SSH -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile="C:\Shares\test\scripts\.ssh\known_hosts" -o PreferredAuthentications=password -o PubkeyAuthentication=no -o PasswordAuthentication=yes "${NAS_USER}@${NAS_IP}" "mkdir -p /volume1/test/COMMON/DOS" 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host "[OK] Directory created/verified" -ForegroundColor Green
} else {
Write-Host "[WARNING] Directory creation: $mkdirResult" -ForegroundColor Yellow
}
Write-Host ""
Write-Host "[3] Copying DOS system files to NAS" -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Gray
$dosFiles = @("AUTOEXEC.BAT", "STARTNET.BAT")
foreach ($file in $dosFiles) {
$localPath = "C:\Shares\test\COMMON\DOS\$file"
$remotePath = "/volume1/test/COMMON/DOS/$file"
if (Test-Path $localPath) {
Write-Host "Copying $file..." -ForegroundColor Cyan
$result = & $SCP -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile="C:\Shares\test\scripts\.ssh\known_hosts" -o PreferredAuthentications=password -o PubkeyAuthentication=no -o PasswordAuthentication=yes $localPath "${NAS_USER}@${NAS_IP}:$remotePath" 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host " [OK] $file" -ForegroundColor Green
$successCount++
} else {
Write-Host " [ERROR] $file - $result" -ForegroundColor Red
$errorCount++
}
} else {
Write-Host " [SKIP] $file - not found" -ForegroundColor Yellow
}
}
Write-Host ""
Write-Host "=" * 80 -ForegroundColor Gray
Write-Host "Summary: $successCount successful, $errorCount errors" -ForegroundColor Cyan
}
Write-Host ""
Write-Host "=== Copy Complete ===" -ForegroundColor Cyan
Write-Host "[INFO] Files are now available on NAS at /volume1/test/" -ForegroundColor Green
Write-Host "[INFO] DOS machines can access via T:\ drive" -ForegroundColor Green