Updated to .NET Framework 4.7.2 due to platform limitations, added email cc, bcc and some fixes.
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$SourcePath,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$InstallPath,
|
||||
|
||||
[string]$EventSource = "BizTalkMonitorConfigGenerator",
|
||||
[string]$EventLogName = "Application",
|
||||
[switch]$RegisterEventSource,
|
||||
[switch]$CreateBackup
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
function Write-Info {
|
||||
param([string]$Message)
|
||||
Write-Host "[INFO] $Message"
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath $SourcePath)) {
|
||||
throw "SourcePath '$SourcePath' existiert nicht."
|
||||
}
|
||||
|
||||
$sourceFullPath = (Resolve-Path -LiteralPath $SourcePath).Path
|
||||
$installFullPath = [System.IO.Path]::GetFullPath($InstallPath)
|
||||
|
||||
Write-Info "Quelldateien: $sourceFullPath"
|
||||
Write-Info "Zielverzeichnis: $installFullPath"
|
||||
|
||||
if (Test-Path -LiteralPath $installFullPath) {
|
||||
if ($CreateBackup) {
|
||||
$backupRoot = Join-Path -Path ([System.IO.Path]::GetDirectoryName($installFullPath)) -ChildPath ((Split-Path -Path $installFullPath -Leaf) + '_backup_' + (Get-Date -Format 'yyyyMMdd_HHmmss'))
|
||||
Write-Info "Erstelle Backup unter $backupRoot"
|
||||
Copy-Item -Path (Join-Path $installFullPath '*') -Destination $backupRoot -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
else {
|
||||
New-Item -Path $installFullPath -ItemType Directory | Out-Null
|
||||
}
|
||||
|
||||
Write-Info "Kopiere Dateien..."
|
||||
Copy-Item -Path (Join-Path $sourceFullPath '*') -Destination $installFullPath -Recurse -Force
|
||||
New-Item -Path (Join-Path $installFullPath 'logs') -ItemType Directory -Force | Out-Null
|
||||
|
||||
if ($RegisterEventSource) {
|
||||
$registerScript = Join-Path -Path $PSScriptRoot -ChildPath 'register-event-source.ps1'
|
||||
if (-not (Test-Path -LiteralPath $registerScript)) {
|
||||
throw "register-event-source.ps1 wurde nicht gefunden: $registerScript"
|
||||
}
|
||||
|
||||
Write-Info "Registriere Event Source '$EventSource' im Log '$EventLogName'"
|
||||
& $registerScript -Source $EventSource -LogName $EventLogName
|
||||
}
|
||||
|
||||
Write-Info 'Installation des BizTalkMonitorConfigGenerator abgeschlossen.'
|
||||
Write-Info 'Prüfen Sie nun generator-settings.json und führen Sie einen Testlauf aus.'
|
||||
Reference in New Issue
Block a user