Automating Deployment of the CorreLog Windows Agent Package with Scripts
Automating deployment of the CorreLog Windows Agent Package reduces manual work, ensures consistent configuration, and speeds rollouts across many Windows hosts. This guide shows a repeatable, script-driven workflow you can adapt for small environments or enterprise-scale deployments using PowerShell and common automation tools.
What you’ll automate
- Downloading the CorreLog Windows Agent installer (MSI or ZIP)
- Installing the agent silently with required options
- Applying configuration files and registry settings
- Registering the agent with CorreLog central server (if required)
- Enabling and starting the CorreLog service
- Basic verification and logging of results
Prerequisites
- Administrator privileges on target Windows machines
- Network access from targets to the CorreLog server and download location
- CorreLog agent installer (MSI or packaged ZIP) accessible via UNC share, HTTP(S) or local path
- PowerShell 5.1 or later (PowerShell 7 recommended for cross-platform scripting)
- Optional: Group Policy, SCCM, Intune, or other endpoint management tool for large-scale rollout
Installer options and silent install
CorreLog agents commonly come as an MSI. MSIs support standard silent-install flags:
- /quiet or /qn — run without UI
- /norestart — prevent automatic reboot
- PROPERTY=VALUE — set installation properties (example: INSTALLDIR=“C:\Program Files\CorreLogAgent”)
If you have a ZIP package, the script should extract files and run the included installer or copy the service binary and configuration files.
PowerShell deployment script (single-host)
Below is a concise PowerShell script template to deploy the CorreLog Windows Agent silently, apply a configuration, enable and start the service, and log success/failure. Adjust paths, property names, and configuration steps to match your CorreLog package.
powershell
# Deploy-CorreLogAgent.ps1 param( [string]\(InstallerPath</span><span> = </span><span class="token" style="color: rgb(163, 21, 21);">"\\fileserver\software\CorreLogAgent\CorreLogAgent.msi"</span><span class="token" style="color: rgb(57, 58, 52);">,</span><span> </span><span> </span><span class="token">[string]</span><span class="token" style="color: rgb(54, 172, 170);">\)ConfigSource = “\fileserver\software\CorreLogAgent\agent.conf”, [string]\(InstallLog</span><span> = </span><span class="token" style="color: rgb(163, 21, 21);">"C:\Temp\CorreLogAgent_Install.log"</span><span class="token" style="color: rgb(57, 58, 52);">,</span><span> </span><span> </span><span class="token">[string]</span><span class="token" style="color: rgb(54, 172, 170);">\)ServiceName = “CorreLogAgent”, [string]\(InstallProperties</span><span> = </span><span class="token" style="color: rgb(163, 21, 21);">""</span><span> </span><span></span><span class="token" style="color: rgb(57, 58, 52);">)</span><span> </span> <span></span><span class="token" style="color: rgb(57, 58, 52);">Start-Transcript</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">-</span><span>Path </span><span class="token" style="color: rgb(54, 172, 170);">\)InstallLog -Force try { Write-Output “Checking admin rights…” if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { throw “Script requires administrative privileges.” } Write-Output “Installer path: \(InstallerPath</span><span class="token" style="color: rgb(163, 21, 21);">"</span><span> </span><span> </span><span class="token" style="color: rgb(0, 0, 255);">if</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">(</span><span class="token" style="color: rgb(57, 58, 52);">-not</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">(</span><span class="token" style="color: rgb(57, 58, 52);">Test-Path</span><span> </span><span class="token" style="color: rgb(54, 172, 170);">\)InstallerPath)) { throw “Installer not found at \(InstallerPath</span><span class="token" style="color: rgb(163, 21, 21);">"</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">}</span><span> </span> <span> </span><span class="token" style="color: rgb(0, 128, 0); font-style: italic;"># Install MSI silently</span><span> </span><span> </span><span class="token" style="color: rgb(54, 172, 170);">\)msiArgs = ”/i"</span><span class="token" style="color: rgb(54, 172, 170);">$InstallerPath</span><span class="token" style="color: rgb(163, 21, 21);">” /qn /norestart \(InstallProperties</span><span class="token" style="color: rgb(163, 21, 21);">"</span><span> </span><span> </span><span class="token" style="color: rgb(57, 58, 52);">Write-Output</span><span> </span><span class="token" style="color: rgb(163, 21, 21);">"Running msiexec </span><span class="token" style="color: rgb(54, 172, 170);">\)msiArgs“ \(install</span><span> = </span><span class="token" style="color: rgb(57, 58, 52);">Start-Process</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">-</span><span>FilePath msiexec</span><span class="token" style="color: rgb(57, 58, 52);">.</span><span>exe </span><span class="token" style="color: rgb(57, 58, 52);">-</span><span>ArgumentList </span><span class="token" style="color: rgb(54, 172, 170);">\)msiArgs -Wait -PassThru if (\(install</span><span class="token" style="color: rgb(57, 58, 52);">.</span><span>ExitCode </span><span class="token" style="color: rgb(57, 58, 52);">-ne</span><span> 0</span><span class="token" style="color: rgb(57, 58, 52);">)</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">{</span><span> </span><span class="token" style="color: rgb(0, 0, 255);">throw</span><span> </span><span class="token" style="color: rgb(163, 21, 21);">"MSI install failed with exit code </span><span class="token" style="color: rgb(57, 58, 52);">\)(\(install</span><span class="token" style="color: rgb(57, 58, 52);">.</span><span class="token" style="color: rgb(57, 58, 52);">ExitCode</span><span class="token" style="color: rgb(57, 58, 52);">)</span><span class="token" style="color: rgb(163, 21, 21);">"</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">}</span><span> </span><span> </span><span class="token" style="color: rgb(57, 58, 52);">Write-Output</span><span> </span><span class="token" style="color: rgb(163, 21, 21);">"Install completed."</span><span> </span> <span> </span><span class="token" style="color: rgb(0, 128, 0); font-style: italic;"># Deploy configuration file (optional)</span><span> </span><span> </span><span class="token" style="color: rgb(0, 0, 255);">if</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">(</span><span class="token" style="color: rgb(57, 58, 52);">Test-Path</span><span> </span><span class="token" style="color: rgb(54, 172, 170);">\)ConfigSource) { \(destConfig</span><span> = </span><span class="token" style="color: rgb(163, 21, 21);">"C:\Program Files\CorreLogAgent\agent.conf"</span><span> </span><span> </span><span class="token" style="color: rgb(57, 58, 52);">Copy-Item</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">-</span><span>Path </span><span class="token" style="color: rgb(54, 172, 170);">\)ConfigSource -Destination \(destConfig</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">-</span><span>Force </span><span> </span><span class="token" style="color: rgb(57, 58, 52);">Write-Output</span><span> </span><span class="token" style="color: rgb(163, 21, 21);">"Copied config to </span><span class="token" style="color: rgb(54, 172, 170);">\)destConfig” } else { Write-Output “Config source not found; skipping config copy.” } # Start and enable service if (Get-Service -Name \(ServiceName</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">-</span><span>ErrorAction SilentlyContinue</span><span class="token" style="color: rgb(57, 58, 52);">)</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">{</span><span> </span><span> </span><span class="token" style="color: rgb(57, 58, 52);">Set-Service</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">-</span><span>Name </span><span class="token" style="color: rgb(54, 172, 170);">\)ServiceName -StartupType Automatic Start-Service -Name \(ServiceName</span><span> </span><span> </span><span class="token" style="color: rgb(57, 58, 52);">Write-Output</span><span> </span><span class="token" style="color: rgb(163, 21, 21);">"Service </span><span class="token" style="color: rgb(54, 172, 170);">\)ServiceName started and set to automatic.” } else { Write-Output “Service \(ServiceName</span><span class="token" style="color: rgb(163, 21, 21);"> not found after install."</span><span> </span><span> </span><span class="token" style="color: rgb(57, 58, 52);">}</span><span> </span> <span> </span><span class="token" style="color: rgb(57, 58, 52);">Write-Output</span><span> </span><span class="token" style="color: rgb(163, 21, 21);">"Deployment completed successfully."</span><span> </span><span></span><span class="token" style="color: rgb(57, 58, 52);">}</span><span> </span><span class="token" style="color: rgb(0, 0, 255);">catch</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">{</span><span> </span><span> </span><span class="token" style="color: rgb(57, 58, 52);">Write-Error</span><span> </span><span class="token" style="color: rgb(163, 21, 21);">"Deployment failed: </span><span class="token" style="color: rgb(54, 172, 170);">\)_” Exit 1 } finally { Stop-Transcript }
Multi-host deployment approaches
- Group Policy (GPO): Use Computer Configuration → Software Installation to assign the MSI. Good for domain-joined machines.
- SCCM / Microsoft Endpoint Configuration Manager: Create an application or package with detection rules and deployment settings.
- Intune: Use Win32 app packaging to deploy the MSI to managed devices.
- PowerShell Remoting / WinRM: Run the above script remotely using Invoke-Command or use PSExec for machines without WinRM.
- Ansible (Windows modules), Salt, or other orchestration tools: Wrap the same steps in playbooks or states.
Idempotence and configuration management
- Ensure scripts check installation state (e.g., MSI product code, service existence) to avoid repeated installs.
- Use configuration files and registry keys for agent settings rather than one-off command-line flags when possible.
- Log each step’s outcome to a central log share or to Windows Event Log for auditing.
Verifying successful deployment
- Service is running: Get-Service -Name CorreLogAgent
- Agent reports to CorreLog server (check CorreLog console or server logs)
- Local log files: C:\ProgramData\CorreLogAgent\logs or configured path
- Exit codes from msiexec should be 0 for success
Rollback and error handling
- Capture msiexec exit codes and write them to logs.
- Provide an uninstall command for rollback: msiexec /x {PRODUCT-CODE} /qn /norestart
- If configuration copy fails, revert to bundled default config or uninstall if necessary.
Security and best practices
- Run installs with least-privilege via delegated admin accounts where possible.
- Sign installers and scripts; verify checksums before installing.
- Avoid embedding credentials in scripts. Use managed identities, certificates, or secret stores.
- Test in a staging environment before production rollouts.
Example: automation pipeline
- Build artifact: Place MSI and configs on secure file server or artifact repo.
- Test deploy: Run script against a test host or VM.
- Package for management tool: Create SCCM/Intune package or GPO entry.
- Gradual rollout: Deploy to pilot group, monitor, then roll to broader groups.
- Monitor and iterate: Collect logs, fix issues, update install properties as needed.
Summary
Automating CorreLog Windows Agent deployment with scripts lowers manual overhead and increases consistency. Use the PowerShell template above as a starting point, adapt for your environment, incorporate idempotence and secure handling of credentials, and deploy at scale using endpoint management tools for enterprise environments.
Leave a Reply