Private/Get-DNSFilterAgentService.ps1
|
function Get-DNSFilterAgentService { <# .SYNOPSIS Internal helper. Looks up the DNSFilter roaming client's Windows service under any known name. .DESCRIPTION The service is named "DNS Agent" on whitelabeled/MSP-branded installs and "DNSFilter Agent" on the standard installer. Checks both, plus the older "DNSAgent" (no space) name, and returns the first match. #> [CmdletBinding()] param() process { $knownNames = @('DNS Agent', 'DNSFilter Agent', 'DNSAgent') foreach ($name in $knownNames) { $service = Get-Service -Name $name -ErrorAction SilentlyContinue if ($service) { return $service } } return $null } } |