Files
webhook-server/scripts/uninstall-service.ps1
T
justin 8ecfe84540 Initial WebhookServer implementation
Add the .NET 8 solution scaffolded against PLAN.md. Three projects share
WebhookServer.Core (models, auth, execution, storage, IPC, callbacks)
and WebhookServer.Service hosts an embedded Kestrel listener plus the
named-pipe admin server. WebhookServer.Gui is a thin MVVM client over
the pipe. Includes 25 unit tests covering HMAC verification, bearer
auth, IP allowlist parsing, arg-template rendering, DPAPI round-trip,
and the encrypt-on-save config store.

Install/uninstall PowerShell scripts default to LocalSystem and accept
a domain user or gMSA via -ServiceAccount.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 22:04:52 -04:00

39 lines
927 B
PowerShell

<#
.SYNOPSIS
Stops and removes the WebhookServer Windows Service.
.DESCRIPTION
Leaves C:\ProgramData\WebhookServer (config + logs) untouched. Pass -PurgeData
to remove that directory as well.
#>
[CmdletBinding()]
param(
[string]$ServiceName = 'WebhookServer',
[switch]$PurgeData
)
$ErrorActionPreference = 'Stop'
$existing = sc.exe query $ServiceName 2>$null
if (-not $existing) {
Write-Host "Service '$ServiceName' is not installed."
return
}
Write-Host "Stopping service '$ServiceName'..."
sc.exe stop $ServiceName 2>$null | Out-Null
Start-Sleep -Seconds 2
Write-Host "Deleting service '$ServiceName'..."
sc.exe delete $ServiceName | Out-Null
if ($PurgeData) {
$dataRoot = Join-Path $env:ProgramData 'WebhookServer'
if (Test-Path -LiteralPath $dataRoot) {
Write-Host "Removing $dataRoot"
Remove-Item -LiteralPath $dataRoot -Recurse -Force
}
}
Write-Host 'Done.'