31 lines
1.2 KiB
PowerShell
31 lines
1.2 KiB
PowerShell
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "High")]
|
|
param(
|
|
[string]$InstallDirectory = "$env:ProgramFiles\BizTalkCheckmkPulse",
|
|
[string]$CheckmkLocalDirectory = "$env:ProgramData\checkmk\agent\local",
|
|
[switch]$KeepRuntimeData
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$taskName = "BizTalk Checkmk Pulse Provider"
|
|
$runtimeRoot = Join-Path $env:ProgramData "BizTalkCheckmkPulse"
|
|
$wrapper = Join-Path $CheckmkLocalDirectory "biztalk_checkmk_pulse.cmd"
|
|
|
|
if ($PSCmdlet.ShouldProcess($taskName, "Scheduled Task entfernen")) {
|
|
Unregister-ScheduledTask -TaskName $taskName -Confirm:$false -ErrorAction SilentlyContinue
|
|
}
|
|
if (Test-Path -LiteralPath $wrapper) {
|
|
if ($PSCmdlet.ShouldProcess($wrapper, "Checkmk Local Check entfernen")) {
|
|
Remove-Item -LiteralPath $wrapper -Force
|
|
}
|
|
}
|
|
if (Test-Path -LiteralPath $InstallDirectory) {
|
|
if ($PSCmdlet.ShouldProcess($InstallDirectory, "Programmdateien entfernen")) {
|
|
Remove-Item -LiteralPath $InstallDirectory -Recurse -Force
|
|
}
|
|
}
|
|
if (-not $KeepRuntimeData -and (Test-Path -LiteralPath $runtimeRoot)) {
|
|
if ($PSCmdlet.ShouldProcess($runtimeRoot, "Snapshot und Logs entfernen")) {
|
|
Remove-Item -LiteralPath $runtimeRoot -Recurse -Force
|
|
}
|
|
}
|