Complete project organization: move all DOS files to projects/dataforth-dos, create client folders, update Claude config
This commit is contained in:
32
test-ssh-after-key.ps1
Normal file
32
test-ssh-after-key.ps1
Normal file
@@ -0,0 +1,32 @@
|
||||
$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force
|
||||
$cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password)
|
||||
|
||||
Write-Host "Testing SSH After Adding Key..." -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
|
||||
Write-Host "[1] Testing SSH as sysadmin user..." -ForegroundColor Yellow
|
||||
$result = & ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@192.168.0.9 "hostname" 2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [SUCCESS] SSH works! Result: $result" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " [FAILED] SSH failed: $result" -ForegroundColor Red
|
||||
Write-Host " Exit code: $LASTEXITCODE" -ForegroundColor Red
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "[2] Testing find command..." -ForegroundColor Yellow
|
||||
$findResult = & ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no root@192.168.0.9 "find /data/test/TS-4R/LOGS -name '*.DAT' -type f -mmin -1440 2>/dev/null | wc -l" 2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " [SUCCESS] Find command works! Found: $findResult DAT files" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " [FAILED] Find failed: $findResult" -ForegroundColor Red
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "[3] Manually running sync script..." -ForegroundColor Yellow
|
||||
& powershell.exe -ExecutionPolicy Bypass -File "C:\Shares\test\scripts\Sync-FromNAS.ps1"
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Test complete!" -ForegroundColor Cyan
|
||||
Reference in New Issue
Block a user