Public/ps1/Configuration/Service/Stop-ApprxrService.ps1
|
function Stop-ApprxrService { <# .SYNOPSIS Stops the Apprxr Windows service. .DESCRIPTION Stops the Apprxr service using standard Windows service management cmdlets. The service name can be specified using the NameExtension parameter, or determined from configuration for the current session. .PARAMETER NameExtension Optional. If specified, stops the service named 'ApprxrService_<NameExtension>'. If not specified, uses the configured service name for the session via Get-ServiceNameApprxr. .EXAMPLE Stop-ApprxrService -NameExtension 'Test' # Stops the service 'ApprxrService_Test'. .EXAMPLE Stop-ApprxrService # Stops the currently configured Apprxr service for the session. #> [CmdletBinding()] param( [string]$NameExtension ) $serviceName = if ($NameExtension) { "ApprxrService$NameExtension" } else { Get-ServiceNameApprxr } Stop-Service -Name $serviceName -Force Write-Host "Service '$serviceName' stopped." -ForegroundColor Yellow } |