Files
claudetools/clients/dataforth/scripts/test-ad2-network.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

59 lines
2.8 KiB
PowerShell

$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password)
Write-Host "Testing Network Connectivity from AD2 to NAS..." -ForegroundColor Cyan
Write-Host ""
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
Write-Host "[1] Testing ping to NAS (192.168.0.9)..." -ForegroundColor Yellow
$ping = Test-Connection -ComputerName 192.168.0.9 -Count 2 -ErrorAction SilentlyContinue
if ($ping) {
Write-Host " [OK] Ping successful - average: $($ping | Measure-Object -Property ResponseTime -Average | Select-Object -ExpandProperty Average)ms" -ForegroundColor Green
} else {
Write-Host " [ERROR] Ping failed" -ForegroundColor Red
}
Write-Host ""
Write-Host "[2] Testing TCP connection to port 22..." -ForegroundColor Yellow
$tcpTest = Test-NetConnection -ComputerName 192.168.0.9 -Port 22 -InformationLevel Detailed -WarningAction SilentlyContinue
Write-Host " TCP Connection: $($tcpTest.TcpTestSucceeded)" -ForegroundColor $(if ($tcpTest.TcpTestSucceeded) { "Green" } else { "Red" })
Write-Host " Ping: $($tcpTest.PingSucceeded)" -ForegroundColor White
Write-Host " Route: $($tcpTest.InterfaceAlias)" -ForegroundColor White
Write-Host ""
Write-Host "[3] Checking Windows Firewall outbound rules..." -ForegroundColor Yellow
$firewallRule = Get-NetFirewallRule | Where-Object { $_.Direction -eq "Outbound" -and $_.Action -eq "Block" } | Select-Object -First 5
if ($firewallRule) {
Write-Host " Found $($firewallRule.Count) outbound block rules (showing first 5)" -ForegroundColor Yellow
} else {
Write-Host " No outbound block rules found" -ForegroundColor Green
}
Write-Host ""
Write-Host "[4] Checking current user SSH directory..." -ForegroundColor Yellow
$sshDir = "$env:USERPROFILE\.ssh"
if (Test-Path $sshDir) {
Write-Host " SSH directory exists: $sshDir" -ForegroundColor Green
$files = Get-ChildItem $sshDir -ErrorAction SilentlyContinue
if ($files) {
Write-Host " Contents:" -ForegroundColor White
$files | ForEach-Object { Write-Host " $($_.Name)" -ForegroundColor Gray }
}
} else {
Write-Host " [WARNING] No .ssh directory found" -ForegroundColor Yellow
}
Write-Host ""
Write-Host "[5] Trying telnet-style connection test..." -ForegroundColor Yellow
try {
$socket = New-Object System.Net.Sockets.TcpClient
$socket.Connect("192.168.0.9", 22)
if ($socket.Connected) {
Write-Host " [OK] Raw TCP socket connection successful" -ForegroundColor Green
$socket.Close()
}
} catch {
Write-Host " [ERROR] Raw TCP socket connection failed: $($_.Exception.Message)" -ForegroundColor Red
}
}