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>
81 lines
2.4 KiB
PowerShell
81 lines
2.4 KiB
PowerShell
# Stop any running GuruRMM agent processes and install service
|
|
|
|
Write-Host "[INFO] Stopping any running GuruRMM agent processes..."
|
|
|
|
# Check for running processes
|
|
$processes = Get-Process -Name "gururmm-agent" -ErrorAction SilentlyContinue
|
|
if ($processes) {
|
|
Write-Host "[WARNING] Found $($processes.Count) running agent process(es)"
|
|
foreach ($proc in $processes) {
|
|
Write-Host " Killing PID $($proc.Id)..."
|
|
Stop-Process -Id $proc.Id -Force
|
|
}
|
|
Start-Sleep -Seconds 2
|
|
Write-Host "[OK] Processes stopped"
|
|
} else {
|
|
Write-Host "[INFO] No running agent processes found"
|
|
}
|
|
|
|
# Check for any service (even if not registered properly)
|
|
try {
|
|
$service = Get-Service -Name "gururmm-agent" -ErrorAction SilentlyContinue
|
|
if ($service) {
|
|
Write-Host "[WARNING] Found service - stopping..."
|
|
Stop-Service -Name "gururmm-agent" -Force
|
|
Start-Sleep -Seconds 2
|
|
}
|
|
} catch {
|
|
# Service might not exist, that's OK
|
|
}
|
|
|
|
# Now install
|
|
Write-Host ""
|
|
Write-Host "[INFO] Installing GuruRMM agent as service on AD2..."
|
|
|
|
$serverUrl = "wss://rmm-api.azcomputerguru.com/ws"
|
|
$apiKey = "SWIFT-CLOUD-6910"
|
|
$agentPath = "C:\Program Files\GuruRMM\gururmm-agent.exe"
|
|
|
|
if (!(Test-Path $agentPath)) {
|
|
Write-Host "[ERROR] Agent binary not found at $agentPath"
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "[OK] Agent binary found"
|
|
Write-Host "[INFO] Installing agent as service..."
|
|
Write-Host " Server URL: $serverUrl"
|
|
Write-Host " API Key: $apiKey"
|
|
|
|
& $agentPath install --server-url $serverUrl --api-key $apiKey
|
|
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "[ERROR] Installation failed with exit code: $LASTEXITCODE"
|
|
exit 1
|
|
}
|
|
|
|
Start-Sleep -Seconds 2
|
|
|
|
# Verify service was created
|
|
$service = Get-Service -Name "gururmm-agent" -ErrorAction SilentlyContinue
|
|
if ($service) {
|
|
Write-Host "[OK] Service created successfully"
|
|
Write-Host " Name: $($service.Name)"
|
|
Write-Host " Status: $($service.Status)"
|
|
Write-Host " Start Type: $($service.StartType)"
|
|
|
|
if ($service.Status -ne "Running") {
|
|
Write-Host "[INFO] Starting service..."
|
|
Start-Service -Name "gururmm-agent"
|
|
Start-Sleep -Seconds 2
|
|
|
|
$service = Get-Service -Name "gururmm-agent"
|
|
Write-Host "[OK] Service status: $($service.Status)"
|
|
}
|
|
} else {
|
|
Write-Host "[ERROR] Service was not created"
|
|
exit 1
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "[SUCCESS] GuruRMM agent installed and running on AD2!"
|