Updated to .NET Framework 4.7.2 due to platform limitations, added email cc, bcc and some fixes.

This commit is contained in:
2026-04-21 11:46:55 +02:00
parent c267069d02
commit b8b702bda3
40 changed files with 5666 additions and 2064 deletions
+37
View File
@@ -0,0 +1,37 @@
# Installers
This repository contains two installer approaches for both console applications.
## 1. PowerShell installers
Recommended for most BizTalk / Windows Server environments.
Files:
- `powershell/Install-HostAvailabilityMonitor.ps1`
- `powershell/Install-BizTalkMonitorConfigGenerator.ps1`
- `powershell/Install-Both.ps1`
- `powershell/Uninstall-HostAvailabilityMonitor.ps1`
- `powershell/Uninstall-BizTalkMonitorConfigGenerator.ps1`
These scripts install the binaries, create required directories, copy a default configuration when missing, and can optionally register event log sources.
## 2. WiX MSI sources
Optional MSI source files are provided in `wix/`.
Files:
- `wix/HostAvailabilityMonitor.wxs`
- `wix/BizTalkMonitorConfigGenerator.wxs`
- `wix/build-msi.ps1`
Requirements:
- Windows build machine
- WiX Toolset v3 in PATH (`candle.exe`, `light.exe`)
- publish output already present in `artifacts\publish\net472`
Note: the WiX files are intentionally minimal starter installers and may be extended later with service/task registration, shortcuts, custom actions, or richer upgrade rules.
## Email configuration
The deployed monitor configuration supports `To`, `Cc`, and `Bcc` arrays for email recipients. Configure one address per array element.
@@ -0,0 +1,34 @@
param(
[string]$PackageRoot = (Split-Path -Parent $PSScriptRoot),
[string]$InstallPath = "C:\Program Files\JR IT Services\BizTalkMonitorConfigGenerator",
[string]$ConfigRoot = "C:\ProgramData\JR IT Services\BizTalkMonitorConfigGenerator",
[switch]$RegisterEventSource,
[switch]$CreateBackup
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$repoScripts = Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) 'scripts'
$generatorSource = Join-Path $PackageRoot 'generator'
if (-not (Test-Path -LiteralPath $generatorSource)) {
$generatorSource = Join-Path (Split-Path -Parent $PackageRoot) 'generator'
}
if (-not (Test-Path -LiteralPath $generatorSource)) {
throw "Generator source folder not found below package root: $PackageRoot"
}
& (Join-Path $repoScripts 'install-generator-on-server.ps1') `
-SourcePath $generatorSource `
-InstallPath $InstallPath `
-RegisterEventSource:$RegisterEventSource `
-CreateBackup:$CreateBackup
New-Item -Path $ConfigRoot -ItemType Directory -Force | Out-Null
$configFile = Join-Path $ConfigRoot 'generator-settings.json'
$defaultConfig = Join-Path $InstallPath 'generator-settings.json'
if ((Test-Path -LiteralPath $defaultConfig) -and (-not (Test-Path -LiteralPath $configFile))) {
Copy-Item -Path $defaultConfig -Destination $configFile -Force
}
Write-Host "[INFO] BizTalkMonitorConfigGenerator installed to $InstallPath"
Write-Host "[INFO] Config location: $configFile"
+33
View File
@@ -0,0 +1,33 @@
param(
[string]$PackageRoot = (Split-Path -Parent $PSScriptRoot),
[string]$BaseInstallPath = "C:\Program Files\JR IT Services\BizTalk Endpoint Monitor",
[string]$BaseConfigPath = "C:\ProgramData\JR IT Services\BizTalk Endpoint Monitor",
[switch]$RegisterEventSources,
[switch]$CreateBackup
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$hostScript = Join-Path $PSScriptRoot 'Install-HostAvailabilityMonitor.ps1'
$genScript = Join-Path $PSScriptRoot 'Install-BizTalkMonitorConfigGenerator.ps1'
& $genScript `
-PackageRoot $PackageRoot `
-InstallPath (Join-Path $BaseInstallPath 'BizTalkMonitorConfigGenerator') `
-ConfigRoot (Join-Path $BaseConfigPath 'BizTalkMonitorConfigGenerator') `
-RegisterEventSource:$RegisterEventSources `
-CreateBackup:$CreateBackup
& $hostScript `
-PackageRoot $PackageRoot `
-InstallPath (Join-Path $BaseInstallPath 'HostAvailabilityMonitor') `
-ConfigRoot (Join-Path $BaseConfigPath 'HostAvailabilityMonitor') `
-RegisterEventSource:$RegisterEventSources `
-CreateBackup:$CreateBackup
Write-Host "[INFO] Both applications have been installed."
Write-Host "[INFO] Suggested next steps:"
Write-Host "[INFO] 1. Adjust generator settings in ProgramData."
Write-Host "[INFO] 2. Run generator once to create generated-monitor-appsettings.json."
Write-Host "[INFO] 3. Start HostAvailabilityMonitor with the generated JSON path."
@@ -0,0 +1,34 @@
param(
[string]$PackageRoot = (Split-Path -Parent $PSScriptRoot),
[string]$InstallPath = "C:\Program Files\JR IT Services\HostAvailabilityMonitor",
[string]$ConfigRoot = "C:\ProgramData\JR IT Services\HostAvailabilityMonitor",
[switch]$RegisterEventSource,
[switch]$CreateBackup
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$repoScripts = Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) 'scripts'
$monitorSource = Join-Path $PackageRoot 'monitor'
if (-not (Test-Path -LiteralPath $monitorSource)) {
$monitorSource = Join-Path (Split-Path -Parent $PackageRoot) 'monitor'
}
if (-not (Test-Path -LiteralPath $monitorSource)) {
throw "Monitor source folder not found below package root: $PackageRoot"
}
& (Join-Path $repoScripts 'install-on-server.ps1') `
-SourcePath $monitorSource `
-InstallPath $InstallPath `
-RegisterEventSource:$RegisterEventSource `
-CreateBackup:$CreateBackup
New-Item -Path $ConfigRoot -ItemType Directory -Force | Out-Null
$configFile = Join-Path $ConfigRoot 'appsettings.json'
$defaultConfig = Join-Path $InstallPath 'appsettings.json'
if ((Test-Path -LiteralPath $defaultConfig) -and (-not (Test-Path -LiteralPath $configFile))) {
Copy-Item -Path $defaultConfig -Destination $configFile -Force
}
Write-Host "[INFO] HostAvailabilityMonitor installed to $InstallPath"
Write-Host "[INFO] Config location: $configFile"
@@ -0,0 +1,18 @@
param(
[string]$InstallPath = "C:\Program Files\JR IT Services\BizTalkMonitorConfigGenerator",
[string]$ConfigRoot = "C:\ProgramData\JR IT Services\BizTalkMonitorConfigGenerator",
[switch]$RemoveConfig
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
if (Test-Path -LiteralPath $InstallPath) {
Remove-Item -LiteralPath $InstallPath -Recurse -Force
Write-Host "[INFO] Removed $InstallPath"
}
if ($RemoveConfig -and (Test-Path -LiteralPath $ConfigRoot)) {
Remove-Item -LiteralPath $ConfigRoot -Recurse -Force
Write-Host "[INFO] Removed $ConfigRoot"
}
@@ -0,0 +1,18 @@
param(
[string]$InstallPath = "C:\Program Files\JR IT Services\HostAvailabilityMonitor",
[string]$ConfigRoot = "C:\ProgramData\JR IT Services\HostAvailabilityMonitor",
[switch]$RemoveConfig
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
if (Test-Path -LiteralPath $InstallPath) {
Remove-Item -LiteralPath $InstallPath -Recurse -Force
Write-Host "[INFO] Removed $InstallPath"
}
if ($RemoveConfig -and (Test-Path -LiteralPath $ConfigRoot)) {
Remove-Item -LiteralPath $ConfigRoot -Recurse -Force
Write-Host "[INFO] Removed $ConfigRoot"
}
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="BizTalkMonitorConfigGenerator" Language="1033" Version="1.0.0.0" Manufacturer="JR IT Services" UpgradeCode="6E45A4E8-C0C3-4267-8873-B2CF8173E9B2">
<Package InstallerVersion="500" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version is already installed." />
<MediaTemplate EmbedCab="yes" />
<PropertyRef Id="WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED" />
<Condition Message=".NET Framework 4.7.2 or later is required."><![CDATA[Installed OR WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED]]></Condition>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="JRITSERVICES" Name="JR IT Services">
<Directory Id="INSTALLDIR" Name="BizTalkMonitorConfigGenerator" />
</Directory>
</Directory>
</Directory>
<Feature Id="MainFeature" Title="BizTalkMonitorConfigGenerator" Level="1">
<ComponentGroupRef Id="GeneratorHarvest" />
</Feature>
</Product>
</Wix>
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="HostAvailabilityMonitor" Language="1033" Version="1.0.0.0" Manufacturer="JR IT Services" UpgradeCode="A4FC4B18-EA15-4F83-8B19-06D79AA2F2A8">
<Package InstallerVersion="500" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version is already installed." />
<MediaTemplate EmbedCab="yes" />
<PropertyRef Id="WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED" />
<Condition Message=".NET Framework 4.7.2 or later is required."><![CDATA[Installed OR WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED]]></Condition>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="JRITSERVICES" Name="JR IT Services">
<Directory Id="INSTALLDIR" Name="HostAvailabilityMonitor" />
</Directory>
</Directory>
</Directory>
<Feature Id="MainFeature" Title="HostAvailabilityMonitor" Level="1">
<ComponentGroupRef Id="MonitorHarvest" />
</Feature>
</Product>
</Wix>
+47
View File
@@ -0,0 +1,47 @@
param(
[string]$PublishRoot = ".\artifacts\publish\net472",
[string]$OutputRoot = ".\artifacts\msi"
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
function Get-WixTool {
param([string]$Name)
$cmd = Get-Command $Name -ErrorAction SilentlyContinue
if ($cmd) { return $cmd.Source }
throw "$Name was not found. Install WiX Toolset v3 and ensure heat.exe, candle.exe and light.exe are in PATH."
}
$repoRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot)
$publishRootFull = [System.IO.Path]::GetFullPath((Join-Path $repoRoot $PublishRoot))
$outputRootFull = [System.IO.Path]::GetFullPath((Join-Path $repoRoot $OutputRoot))
New-Item -Path $outputRootFull -ItemType Directory -Force | Out-Null
$heat = Get-WixTool -Name 'heat.exe'
$candle = Get-WixTool -Name 'candle.exe'
$light = Get-WixTool -Name 'light.exe'
$packages = @(
@{ Name = 'HostAvailabilityMonitor'; ProductFile = 'HostAvailabilityMonitor.wxs'; HarvestFile = 'Harvest_HostAvailabilityMonitor.wxs'; PublishDir = 'HostAvailabilityMonitor'; ComponentGroup = 'MonitorHarvest' },
@{ Name = 'BizTalkMonitorConfigGenerator'; ProductFile = 'BizTalkMonitorConfigGenerator.wxs'; HarvestFile = 'Harvest_BizTalkMonitorConfigGenerator.wxs'; PublishDir = 'BizTalkMonitorConfigGenerator'; ComponentGroup = 'GeneratorHarvest' }
)
foreach ($package in $packages) {
$sourceDir = Join-Path $publishRootFull $package.PublishDir
if (-not (Test-Path -LiteralPath $sourceDir)) {
throw "Publish directory not found: $sourceDir"
}
$harvestPath = Join-Path $outputRootFull $package.HarvestFile
$productPath = Join-Path $PSScriptRoot $package.ProductFile
$productObj = Join-Path $outputRootFull ($package.Name + '.wixobj')
$harvestObj = Join-Path $outputRootFull ($package.Name + '.harvest.wixobj')
$msiPath = Join-Path $outputRootFull ($package.Name + '.msi')
& $heat dir $sourceDir -cg $package.ComponentGroup -dr INSTALLDIR -gg -scom -sreg -sfrag -var var.SourceDir -out $harvestPath
& $candle -ext WixNetFxExtension -dSourceDir=$sourceDir -out $productObj $productPath
& $candle -ext WixNetFxExtension -dSourceDir=$sourceDir -out $harvestObj $harvestPath
& $light -ext WixNetFxExtension -out $msiPath $productObj $harvestObj
Write-Host "Built MSI: $msiPath"
}