ps/Modules/Alkami.PowerShell.Services/Public/Get-ServicesToStart.ps1
2023-05-30 22:51:22 -07:00

68 lines
2.2 KiB
PowerShell

function Get-ServicesToStart {
<#
.SYNOPSIS
Returns service names for legacy and Chocolatey services, plus filebeats, which need to be started.
.DESCRIPTION
Returns service names for legacy and Chocolatey services, plus filebeats, which need to be started. Can optionally skip Legacy or Chocolatey services. Filebeats is always returned.
.PARAMETER SkipChocolateyServices
[switch] Skips returning Chocolatey services
.PARAMETER SkipAlkamiServices
[switch] Skips returning Alkami services
.EXAMPLE
Get-ServicesToStart
[Get-ChocolateyServices] : Finding services installed out of the chocolatey path: C:\ProgramData\chocolatey
[Get-ChocolateyServices] : Found 4 chocolatey services.
Alkami Radium Scheduler Service
Alkami.MicroServices.Authorization.Service.Host
Alkami.MicroServices.Features.Beacon.Host
Filebeat (Haystack)
.EXAMPLE
Get-ServicesToStart -SkipChocolateyServices
Alkami Radium Scheduler Service
Alkami.MicroServices.Authorization.Service.Host
Alkami.MicroServices.Features.Beacon.Host
Filebeat (Haystack)
.EXAMPLE
Get-ServicesToStart -SkipAlkamiServices
[Get-ChocolateyServices] : Finding services installed out of the chocolatey path: C:\ProgramData\chocolatey
[Get-ChocolateyServices] : Found 4 chocolatey services.
Alkami.MicroServices.Authorization.Service.Host
Alkami.MicroServices.Features.Beacon.Host
Filebeat (Haystack)
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory=$false)]
[switch]$SkipChocolateyServices,
[Parameter(Mandatory=$false)]
[switch]$SkipAlkamiServices
)
$servicesTostart = @()
if (!($skipAlkamiServices.IsPresent))
{
$alkamiServices = @(Get-AlkamiServices)
$legacyServicesToStart += @($alkamiServices | Where-Object { $_.Status -eq "Stopped" -and $_.Name -notmatch "Subscriptions" -and $_.Name -notmatch "Broker" })
$servicesToStart += $legacyServicesToStart | ForEach-Object { $_.Name }
}
if (!$skipChocolateyServices.IsPresent)
{
$chocolateyServices = @(Get-ChocolateyServices | Where-Object { $_.State -eq "Stopped" -and $_.Name -notmatch "Subscriptions" })
$servicesToStart += $chocolateyServices | ForEach-Object {$_.Name}
}
return $servicesToStart | Select-Object -Unique
}