# ๐Ÿš€ GeoVLogSvc - Windows Service Deployment Guide This README provides comprehensive instructions for installing, configuring, and managing the **GeoVLogSvc** Windows Service using the provided PowerShell installer. This service logs flight sensor data to HDF5 and ensures clean encryption and shutdown via Windows Service lifecycle integration. --- ## ๐Ÿ“ฆ Contents - [Overview](#overview) - [Prerequisites](#prerequisites) - [Installation Instructions](#installation-instructions) - [Script Details](#script-details) - [Service Behavior](#service-behavior) - [Uninstallation](#uninstallation) - [Troubleshooting](#troubleshooting) - [Security and Permissions](#security-and-permissions) - [Support](#support) --- ## ๐Ÿงญ Overview `GeoVLogSvc` is a .NET-based Windows Service that: - Logs GPS and sensor data to `.h5` (HDF5) files in real time. - Maintains a manifest describing each flight session. - Automatically encrypts the manifest and securely deletes plaintext `.h5` on shutdown. - Supports Windows 10+ shutdown lifecycle events, including `PreShutdown`. This repository includes a PowerShell script (`Install-GeoVLogSvc.ps1`) to automate deployment without needing a dedicated installer (e.g., MSI) โ€” ideal for development, testing, or field installs. --- ## โœ… Prerequisites Before installing the service, ensure the following: - You are running **Windows 10 or newer**. - You have **Administrator rights** (needed to create services and modify the registry). - .NET Runtime matching the build target of `GeoVLogSvc.exe` is installed. --- ## ๐Ÿ› ๏ธ Installation Instructions ### Step 1: Build the Service Ensure you have built the service using `Release` configuration: ```bash # From Visual Studio or using CLI dotnet build -c Release ``` ### Step 2: Run the Installer Run the PowerShell script **as Administrator**: ```powershell Set-ExecutionPolicy Bypass -Scope Process -Force .\Deployment\Install-GeoVLogSvc.ps1 ``` You may optionally specify custom parameters: ```powershell .\Deployment\Install-GeoVLogSvc.ps1 -ExePath "C:\GeoVLog\GeoVLogSvc.exe" -PreShutdownTimeoutMS 60000 ``` --- ## ๐Ÿ“‹ Script Details The PowerShell script performs the following: 1. **Creates the service**: - Internal name: `GeoVLogSvc` - Display name: `GeoVLog Sensor Logger` - Startup type: `Delayed Automatic` (starts shortly after boot) 2. **Sets recovery actions**: - Restart after 5s (1st failure), 10s (2nd), 60s (3rd) 3. **Configures PreShutdown timeout**: - Sets a registry value for `PreshutdownTimeout` (default: 60 seconds) 4. **Registers the EventLog source**: - Ensures `GeoVLogSvc` can write logs to the Windows Event Log 5. **Starts the service immediately** --- ## โš™๏ธ Service Behavior After installation: - The service runs in the background โ€” no console or window is visible. - It starts automatically at system boot (after system-critical services complete). - It creates a `Logs/` folder in its install directory. - It writes `.h5` sensor logs and a binary flight manifest. - At shutdown (including Windows shutdown), it: - Disposes the HDF5 logger - Finalizes and timestamps the manifest - Encrypts it using AES - Deletes the plaintext `.h5` file if configured to do so All status and error messages are logged to the **Windows Event Viewer** under the **Application log** with source `GeoVLogSvc`. --- ## ๐Ÿงน Uninstallation To remove the service manually: ```powershell Stop-Service GeoVLogSvc sc.exe delete GeoVLogSvc ``` If you'd like a dedicated uninstall script, let us know. --- ## ๐Ÿ›  Troubleshooting | Problem | Solution | |--------|----------| | `Access Denied` error | Make sure PowerShell is run as **Administrator** | | Service not appearing in Services | Run `sc query GeoVLogSvc` to check registration | | EventLog source error | Re-run the script to register source, or run `New-EventLog` manually | | Cleanup not triggered on shutdown | Make sure PreShutdownTimeout is set and service is not forcibly killed too early | --- ## ๐Ÿ” Security and Permissions - The service runs by default as **LocalSystem**. If you require more isolation: - Consider creating a dedicated service user - Adjust permissions on the `Logs/` directory and network access as needed The script sets the service SID type to `unrestricted` for compatibility with custom firewall or access rules. --- ## ๐Ÿ“ž Support / Next Steps - For integration into a proper MSI installer: consider using WiX Toolset. - For audit and traceability: ensure Event Logs are centralized or monitored. - Questions or issues? Please document environment, Windows version, and full logs. --- ยฉ GeoVLog Project โ€” All rights reserved.