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>
114 lines
4.1 KiB
PowerShell
114 lines
4.1 KiB
PowerShell
# Deploy GuruRMM Agent to AD2
|
|
# This script deploys the newly built agent with Claude Code integration
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
Write-Host "[INFO] Starting GuruRMM agent deployment to AD2..."
|
|
|
|
# Credentials
|
|
$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force
|
|
$cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password)
|
|
|
|
# Paths
|
|
$localBinary = "D:\ClaudeTools\projects\msp-tools\guru-rmm\agent\target\release\gururmm-agent.exe"
|
|
$remotePath = "\\192.168.0.6\C$\Program Files\GuruRMM"
|
|
$remoteAgent = "$remotePath\gururmm-agent.exe"
|
|
$remoteBackup = "$remotePath\gururmm-agent.exe.backup"
|
|
|
|
# Connect to AD2
|
|
Write-Host "[INFO] Connecting to AD2 via SMB..."
|
|
New-PSDrive -Name AD2 -PSProvider FileSystem -Root "\\192.168.0.6\C$" -Credential $cred | Out-Null
|
|
Write-Host "[OK] Connected to AD2"
|
|
|
|
# Check if agent directory exists
|
|
if (Test-Path "AD2:\Program Files\GuruRMM") {
|
|
Write-Host "[OK] GuruRMM directory found"
|
|
} else {
|
|
Write-Host "[WARNING] GuruRMM directory not found - creating..."
|
|
New-Item -Path "AD2:\Program Files\GuruRMM" -ItemType Directory | Out-Null
|
|
}
|
|
|
|
# Check for existing agent
|
|
if (Test-Path $remoteAgent) {
|
|
$existingAgent = Get-Item $remoteAgent
|
|
Write-Host "[OK] Found existing agent:"
|
|
Write-Host " Size: $([math]::Round($existingAgent.Length / 1MB, 2)) MB"
|
|
Write-Host " Modified: $($existingAgent.LastWriteTime)"
|
|
} else {
|
|
Write-Host "[INFO] No existing agent found - this will be a fresh install"
|
|
}
|
|
|
|
# Stop the service
|
|
Write-Host "[INFO] Stopping gururmm-agent service on AD2..."
|
|
try {
|
|
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
|
|
$service = Get-Service -Name "gururmm-agent" -ErrorAction SilentlyContinue
|
|
if ($service) {
|
|
if ($service.Status -eq "Running") {
|
|
Stop-Service -Name "gururmm-agent" -Force
|
|
Write-Host "[OK] Service stopped"
|
|
} else {
|
|
Write-Host "[INFO] Service already stopped"
|
|
}
|
|
} else {
|
|
Write-Host "[WARNING] Service not found - may need to be installed"
|
|
}
|
|
}
|
|
} catch {
|
|
Write-Host "[WARNING] Could not stop service via WinRM: $_"
|
|
Write-Host "[INFO] Continuing with deployment..."
|
|
}
|
|
|
|
# Backup existing agent
|
|
if (Test-Path $remoteAgent) {
|
|
Write-Host "[INFO] Backing up existing agent..."
|
|
Copy-Item -Path $remoteAgent -Destination $remoteBackup -Force
|
|
Write-Host "[OK] Backup created: gururmm-agent.exe.backup"
|
|
}
|
|
|
|
# Copy new agent
|
|
Write-Host "[INFO] Copying new agent to AD2..."
|
|
$localInfo = Get-Item $localBinary
|
|
Write-Host " Source size: $([math]::Round($localInfo.Length / 1MB, 2)) MB"
|
|
Copy-Item -Path $localBinary -Destination $remoteAgent -Force
|
|
Write-Host "[OK] Agent copied successfully"
|
|
|
|
# Verify copy
|
|
$copiedAgent = Get-Item $remoteAgent
|
|
Write-Host "[OK] Verification:"
|
|
Write-Host " Size: $([math]::Round($copiedAgent.Length / 1MB, 2)) MB"
|
|
Write-Host " Modified: $($copiedAgent.LastWriteTime)"
|
|
|
|
# Start the service
|
|
Write-Host "[INFO] Starting gururmm-agent service on AD2..."
|
|
try {
|
|
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
|
|
$service = Get-Service -Name "gururmm-agent" -ErrorAction SilentlyContinue
|
|
if ($service) {
|
|
Start-Service -Name "gururmm-agent"
|
|
Start-Sleep -Seconds 2
|
|
$service = Get-Service -Name "gururmm-agent"
|
|
if ($service.Status -eq "Running") {
|
|
Write-Host "[OK] Service started successfully"
|
|
} else {
|
|
Write-Host "[WARNING] Service not running - status: $($service.Status)"
|
|
}
|
|
} else {
|
|
Write-Host "[WARNING] Service not found - manual installation may be required"
|
|
}
|
|
}
|
|
} catch {
|
|
Write-Host "[WARNING] Could not start service via WinRM: $_"
|
|
Write-Host "[INFO] You may need to start the service manually"
|
|
}
|
|
|
|
# Cleanup
|
|
Remove-PSDrive -Name AD2
|
|
Write-Host ""
|
|
Write-Host "[SUCCESS] Deployment complete!"
|
|
Write-Host ""
|
|
Write-Host "Next steps:"
|
|
Write-Host "1. Verify agent reconnected to GuruRMM server"
|
|
Write-Host "2. Test Claude task execution"
|
|
Write-Host ""
|